KL46 UART receive data handling problem with WiFi module

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

KL46 UART receive data handling problem with WiFi module

2,462 次查看
yasararafathcs
Contributor II

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,

标记 (6)
0 项奖励
回复
6 回复数

1,392 次查看
bobpaddock
Senior Contributor III

Something I wrote a while ago about common Queue problems:

Software Safety: Even "Design Patterns" still have bugs. A common Queue bug.

0 项奖励
回复

1,392 次查看
perlam_i_au
Senior Contributor I

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!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,392 次查看
yasararafathcs
Contributor II

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;

  }

}

0 项奖励
回复

1,392 次查看
perlam_i_au
Senior Contributor I

Hello Yasar:

I mean initialization configuration for UART module. could you share it?

0 项奖励
回复

1,392 次查看
bobpaddock
Senior Contributor III

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?

0 项奖励
回复

1,392 次查看
yasararafathcs
Contributor II

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.

0 项奖励
回复