This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48 sci RECEIVE in interrupt mode

Hi 

I am working on the Rm48 evl board. I am using halcongen generated driver for the  sci and other peripherals. i am trying to read and write to the SCI(LIN/sci) either port. i am able to write through the siclinReg but at the time of receive it stuck at the  receive "while ((sci->FLR & SCI_RX_INT) == 0U)". i am not able to proceed further on this path. below are configuration i am using

H/W : J11 pin LIN TX and LIN RX. extra connection coming out of the board and connected to to the putty(PC).

driver setting:

void sciInit(void)
{
/* USER CODE BEGIN (2) */
/* USER CODE END */


/** @b initialize @b SCILIN */

/** - bring SCI out of reset */
scilinREG->GCR0 = 0U;
scilinREG->GCR0 = 1U;

/** - Disable all interrupts */
scilinREG->CLEARINT = 0xFFFFFFFFU;
scilinREG->CLEARINTLVL = 0xFFFFFFFFU;

/** - global control 1 */
scilinREG->GCR1 = (1U << 25U) /* enable transmit */
| (1U << 24U) /* enable receive */
| (1U << 5U) /* internal clock (device has no clock pin) */
| ((2U-1U) << 4U) /* number of stop bits */
| (0U << 3U) /* even parity, otherwise odd */
| (0U << 2U) /* enable parity */
| (1U << 1U); /* asynchronous timing mode */

/** - set baudrate */
scilinREG->BRS = 520U; /* baudrate - 9600 */
// scilinREG->BRS = 12U; /* baudrate - 375000*/


/** - transmission length */
scilinREG->FORMAT = 8U - 1U; /* length */

/** - set SCI pins functional mode */
scilinREG->PIO0 = (1U << 2U) /* tx pin */
| (1U << 1U) /* rx pin */
| (0U); /* clk pin */

/** - set SCI pins default output value */
scilinREG->PIO3 = (0U << 2U) /* tx pin */
| (0U << 1U) /* rx pin */
| (0U); /* clk pin */

/** - set SCI pins output direction */
scilinREG->PIO1 = (0U << 2U) /* tx pin */
| (0U << 1U) /* rx pin */
| (0U); /* clk pin */

/** - set SCI pins open drain enable */
scilinREG->PIO6 = (0U << 2U) /* tx pin */
| (0U << 1U) /* rx pin */
| (0U); /* clk pin */

/** - set SCI pins pullup/pulldown enable */
scilinREG->PIO7 = (0U << 2U) /* tx pin */
| (0U << 1U) /* rx pin */
| (0U); /* clk pin */

/** - set SCI pins pullup/pulldown select */
scilinREG->PIO8 = (1U << 2U) /* tx pin */
| (1U << 1U) /* rx pin */
| (1U); /* clk pin */

/** - set interrupt level */
scilinREG->SETINTLVL = (0U << 26U) /* Framing error */
| (0U << 25U) /* Overrun error */
| (0U << 24U) /* Parity error */
| (0U << 9U) /* Receive */
| (0U << 8U) /* Transmit */
| (0U << 1U) /* Wakeup */
| (0U); /* Break detect */

/** - set interrupt enable */
scilinREG->SETINT = (0U << 26U) /* Framing error */
| (0U << 25U) /* Overrun error */
| (0U << 24U) /* Parity error */
| (1U << 9U) /* Receive */ //lin interrurpt subhash
| (0U << 1U) /* Wakeup */
| (0U); /* Break detect */

/** - initialize global transfer variables */
g_sciTransfer_t[1U].mode = 0U << 8U;
g_sciTransfer_t[1U].tx_length = 0U;
g_sciTransfer_t[1U].rx_length = 0U;

/** - Finaly start SCILIN */
scilinREG->GCR1 |= (1U << 7U);

suggest if i am doing wrong on this. i am facing this issue from past few weeks. immediate help will be anticipated.

And one more thing i am facing is i am not able to send any thing on SCI(sciREG). please help us to make this work.

Regards 

Subhash

  • I don't see where you are writing to the transmit register.
    Have you tried to start with example_sci_uart_9600.c and get this to work first?
    That's what I would suggest.
  • Thanks for the quick response. I am using sciSend() for transmit . it is in the while loop. With the transmit and i am able to send the data. i am facing issues with the receive. i am using sciReceive();

    one more thing i attached the ft232 cable to the J11 106& j11 113 pins for transmit and receive. on the other hyperterminal on another machine i am able to see the data is coming what i sent from the RM48 board. when i am sending data from the another system to the RM 48 board i am not able to see any data on my  receive buffer. if it is in interrupt mode i by passes the sciReceive(), and in the pooling mode it stuck to the while loop. I add the sci tx and rx to the pinmux file with the below path

    PINMMR7 = PINMUX_BALL_R6_ETMDATA_29 | PINMUX_BALL_V5_MDCLK | PINMUX_BALL_W3_SCIRX | PINMUX_BALL_R7_ETMDATA_30;

    pinMuxReg->PINMMR8 = PINMUX_BALL_N2_SCITX | PINMUX_BALL_G3_MDIO | PINMUX_BALL_N1_HET1_15 | PINMUX_BALL_R8_ETMDATA_31;

    with these setting also i am not able to receive any thing on the receive port. 

    Please suggest if any more setting are required on this. I am getting mad while setting and not getting any luck on this. please help

  • Oh, so you are not using the USB<>Serial port that is part of the HDK?

    Many FT232 USB-SERIAL are designed for Arduino and have 5V IO levels. Many others even have an RS232 transceiver which would give an even wider voltage swing and be positive/negative..

    If you are using one of these cables it will likely damage the HDK. Please confirm that your cable has 3.3V LVCMOS IOs for the signals that you connect to J11...

    -Anthony
  • hi,

    This is good point that need to discuss. i checked the FTDI voltage levels. it is showing 3.3 v. it is very interesting to see that SCI(LIN/REG) both are working with the FTDI chip based TTL-232 but fails when we are doing device test and loop back test. still i am not bale to figure out the issue with this RM48 board.

    And more thing that i need to understand is how i can configure RM48 sci to work in the interrupt mode?

    regards

    Subhash Choudhary