Hello,
I am interfacing a sensor using UART1 which accepts command of variable length (22 to 28 bytes). In response to these commands, the sensor acknowledges and attaches the payload response of variable length (27 to 40 bytes). I am using theuart_data_ready_getfto read until data is available. The read length is always 16 bytes. This is not the case when I check the sensor response separately on a COM port. The sensor sends 27 bytes (verified) yet each time, fixed 16 bytes are read when connected to UART1. I have attached debug information PDF. I am stuck in this issue for quite a while. How to tackle this issue to implement flexible receive on UART1?
Note: UART2 is debug UART
int count=0; uint8_t rx_buff[50]; printf_string(UART2, "\n\r<="); while(uart_data_ready_getf(UART1) == 1) { uint8_t buffer[1]; // temporary rx element variable uart_receive(UART1, (uint8_t *)buffer, 1, UART_OP_BLOCKING); rx_buff[count] = buffer[0]; count++; } for(int i=0; i
Keywords:
Device:
Hi Eshwar,
Could you please probe the UART Tx and Rx? Are you using any of the available sleep mode? Additionally, can you please run your project in debug mode? Is it running correctly?
Thanks, PM_Dialog
Hi,
I have verified that the sensor is communicating well and TX frame is correctly reaching the sensor from DA14531. I also checked the sensor with plain UART communication.(attachment)
Tx len: 28 bytes
Rx len 27 bytes
I am not using any sleep modes, my app is based on empty_peripheral_template. I tried force rx read of 27 length but the program crashes at nmi_handler.c.
If I comment out the WDOG macro, still the receive length is 16 bytes
What else can be done to read more than 16 bytes from uart?
Hi Eshwar,
Please try to increase the length parameter in uart_receive().
Thanks, PM_Dialog
Hi,
Upon increasing the length parameter in uart_receive(), the program halts atnmi_handler.cI guess this is because I try to force read 27 bytes when there are not 27 bytes to read from rx FIFO. Can you reproduce this issue for UART read (> 16 bytes) just to be sure this must not happen?
Hi Eshwar,
Can you please check if the WDOD is enabled or disabled? Checkout UART example of the sdk that is using the UART APIs. Which SDK example are you using?
Thanks, PM_Dialog
Hi,
The WDOD is left enabled by default. Rx bytes are still 16 when I disable it. I can read 16 bytes with the following code but not when count >17
Theattachmentshows fault for a force read whencount = 17(WDOD disabled). I am using SDK 6.14 and the example is being referred from the same SDK for API. I am still not able to read more than 16 bytes
I compiled and ran the DSPS_device source code with the sensor. It works and the RX length is 27 with the correct sequence as expected, but this is expected for API also.
Can you please recreate this issue at your end? I can share my full source code if desired
Hi,
Providing additional debug information. This is where the exception occurs
Hi Eshwar,
I saw that your code gets stuck in the platform_reset_func (). The most possible reason why you get this assertion is due to insufficient memory, because you might try to allocate messages that you never consume.
Can you please indicate the steps in order to replicate it?
Thanks, PM_Dialog