Problems using SDK Example UART Interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Problems using SDK Example UART Interrupt

2,265 次查看
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 项奖励
回复
5 回复数

2,242 次查看
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 项奖励
回复

2,210 次查看
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 项奖励
回复

2,201 次查看
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

 

破坏者
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 项奖励
回复

2,166 次查看
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 项奖励
回复

2,105 次查看
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 项奖励
回复