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.

MSPM0L1106: Single line UART communication

Part Number: MSPM0L1106


Tool/software:

Hi Team,

The UART in MSPM0L1106 is working correctly in conventional way. In my application, Tx and Rx pins are connected together to have a single line communication.

The following are the sequence of the communication :
1. By default, Tx pin configured as output low and Rx pin configured as input without any pull resistor.
2. DUT will send data first by configuring Tx pin to UART Tx mode and send the data.
3. When data are sent, Tx pin will configure to input without any pull resistor. Rx pin will configure to UART Rx mode for data receiving.
4. After data are received, Rx pin will configure to input without any pull resistor. Tx pin will configure to UART Tx mode for data transmit if any and repeat from step 2.

With the above, the data transmit and receive are basically OK. However, there is high chance to have first byte with value 0x00 on data receiving. Is there anyway to avoid receiving this leading 0x00?

Thanks.

  • Why the TX pin is configured as output low by default? Could you set it to input too?

  • Hi Yuhao,

    Thank you for your support.

    Due to external circuit requirement, the logic should keep low when there is no data communication.

    For testing purpose, I tried to set Tx pin to input without pull resistor and input with pull low resistor, the same result is obtained.

    AlanC.

  • When Rx pin is configured to UART Rx mode, if the line is low, then Rx received the 0x00 because low level means a new start.

    So maybe you can check the line level. Only when the level is high will you change the RX pin to UART mode.

  • Hi Yuhao,

    I had checked the voltage level on the pins and it is correct. The following is the code on enable and disable the Rx function.

    In Rx enable function, Tx line will set to input with pull high before enable the Rx feature. I also tried to have a dummy read on the receive buffer and it doesn't help.

    In the Rx enable function, I remarked a line highlighted by red rectangle. When this line is enabled, all the data cannot be received. Can you tell me what is the reason?

    AlanC.

  • ‘In Rx enable function, Tx line will set to input with pull high before enable the Rx feature.’

    ‘pull high’ here is the internal pull up resistor, which is 40kohm. Did you observe the waveform of the line? Maybe it is not pull up as expected.

  • Hi Yuhao Zhao,

    Yes, I have observed the waveform of the line by oscilloscope, there is no sudden drop between transmit and receive. 

    In my previous reply, I was trying to clear the receive interrupt so as to prevent this leading 0x00. However it is still not work.

    The thing that make me confuse is that if I cleared the receive interrupt flag before enable the receive interrupt, it will cause the device cannot receive data after the data transmission. Can you tell me what is the reason?

    AlanC.

  • The interrupt is to remind CPU there is one byte received. Even if you clear the interrupt, the message is still in RX buffer(or FIFO). You need to handle it(usually read it)

  • Hi Yuhao Zhao,

    I understand about what you said, but the problem is that when the clear the interrupt is executed (the code highlighted by red rectangle above), no any data was received afterward. Without that code, data is still can be received with extra 0x00 byte received. I tried with a dummy read on the Rx buffer, the result is same, no more data received. (Remark : FIFO is no enabled in my application.)

    From your reply, clear the interrupt should not affect the UART to receive data, should it?

    AlanC.

  • Could you share a simplified code so I can have a quick test.