Problems using SDK Example UART Interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems using SDK Example UART Interrupt

2,172 Views
MWMinor
Contributor V

HI there

I am trying to receive data from a display. The display has a serial port and the system is configured to connect the serial port to the UART4. The display is a touch screen and has various soft keys configured such that when a key is pressed it sends the UART a stream of 6 hex characters. The first character for a key press us 0x07 and tells us there should be 5 more characters to follow.

I have tried to use the UART interrupt example, within the SDK for the development board we have (TWRK60-based product) but in the interrupt handler only the first byte is read.

How can I get the handler to read more than just the first byte in the stream of 6...?

I assumed if I did multiple reads of the UART ie something like;

void DEMO_UART_IRQHandler(void)
{
    uint8_t data;
    uint8_t No_of_Bytes;
    uint8_t i;
 
    /* If new data arrived. */
    if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(DEMO_UART))
    {
    data = UART_ReadByte(DEMO_UART);
 
        /* If ring buffer is not full, add data to ring buffer. */
        if (((rxIndex + 1) % DEMO_RING_BUFFER_SIZE) != txIndex)
        {
        if (data == 0x07)
        {
        No_of_Bytes = 5;
        for (i = 0;i < No_of_Bytes;++i)
        {
        data = UART_ReadByte(DEMO_UART);
        demoRingBuffer[rxIndex] = data;
        rxIndex++;
        rxIndex %= DEMO_RING_BUFFER_SIZE;
        }
        }
        }
    }
}
 
Hope you can help
0 Kudos
Reply
5 Replies

2,149 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, my name is Pavel, and I will support our case, could you let me know what kind of display you are using? Could you add the image of a logic analyzer to know how the display is transmitting?

Best regards,
Pavel

0 Kudos
Reply

2,117 Views
MWMinor
Contributor V

Hi Pavel

The display is made by 4D Systems. It is one of their GEN4-uLCD types.

 

Gen4_Serial.JPEG

The red trace is the data out from the display when the button is pushed. The yellow trace is the response from the MCU.

Ive tried using the interrupt transfer example too, but still struggling.

Thanks for your assistance

Ken

0 Kudos
Reply

2,108 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, how do you know that information is right? I reviewed the datasheet of the LCD, and this has a chapter about Serial communication and has the same standard protocol.

4. Hardware Interface - Pins.

gen4-uLCD-43D Series - 4D Systems' Resource Centre (mouser.com)

Pavel_Hernandez_0-1714077381224.png

 

Spoiler
Pavel_Hernandez_3-1714077495883.png

image from the web as example.

 

This is not similar that you are seeing on the oscilloscope.

Let me know if the datasheet that I found is not the right.

Best regards,
Pavel

 

0 Kudos
Reply

2,073 Views
MWMinor
Contributor V

The sequence captured on the scope is correct, and the hardware it’s running on is sound as the interface works fine on the existing CodeWarrior/MQX platform.

i’ve achieved some success with the interrupt dma transfer example, but I’m struggling to understand how them code works. Is there any better documentation available for this example?

thanks

ken

0 Kudos
Reply

2,012 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello sorry for the late response could you share another image with more zoom on the package of the frame?

Best regards,
Pavel

0 Kudos
Reply