Hi all,
I am using KL46 UART2 to communicate with the WiFi module. Data is able to transmit from the KL46 to WiFi and WiFi to the remote server.
The other way communication i.e.)receiving by the KL46 from the WiFi module is not through. Here at starting I configured with 115200bps baud rate. By that time I am able to receive only the single character randomly from the sent data by the server.
Later I reduced down up to 1200bps. At this point I am able to receive the data but it is in a shuffled manner. For example the characters in the middle coming first and some strange character at the end of the data.
I am using Interrupt Service Routine to receive the data through UART. Anyone facing the same problem. Please help me out.
Thanking you,
Something I wrote a while ago about common Queue problems:
Software Safety: Even "Design Patterns" still have bugs. A common Queue bug.
Hello Yasar:
In this case I would like to take a look to your code just in order to check configurations, could you please share it?
Have a great day,
Perla Moncada
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Andrea,
This is the ISR code I am using
void __irq_interrupt__ wifi_uart_isr(void)
{
register int16_t i;
register uint32_t ui;
register UART_MemMapPtr channel = uartBases[WIFI_UART_NUM]; //WIFI_UART_NUM = 2
ui = UART_S1_REG(channel);
if (ui & UART_S1_RDRF_MASK) {
simSerialBuffer[indxIn1] = UART_D_REG(channel);
i = (indxIn+1) % WIFI_UART_BUF_SIZE; // WIFI_UART_BUF_SIZE = 1024
if (i != indxOut) indxIn = i;
else bufOvrn = 1;
}
}
Hello Yasar:
I mean initialization configuration for UART module. could you share it?
post.user_wrote.label:
if (ui & UART_S1_RDRF_MASK) {
simSerialBuffer[indxIn1] = UART_D_REG(channel);
i = (indxIn+1) % WIFI_UART_BUF_SIZE;
There are two different variables there indexIn*1* and indxIn.
Is that your intention? More appropriate names would be beneficial.
Are the index variables properly declared as volatile?
Does any action need to be taken to clear the status register on that part?
Hi Bob,
Everywhere it is "indxIn" only. I have taken care of clearing the status register.
I am going through the blog you referred.
Thanking you.