cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in sending continuous stream of data in UART

prashanth.mohan22
Associate III

Hi,

Please find the piece of code, where i'm transmitting a buffer of 255 bytes of data.

int main(void) {
	uint8_t read[255];
	uint16_t size;
	for(i=0;i<255;i++)
	{
		read[i]=i+1;
	}
	size = sizeof(read)/sizeof(read[0]);
 
	componentsInit();
 
	irqIsrEnable();
 
	sd_lld_start(&SD2, &serial_config_cfg1);
 
	if(sd_lld_write(&SD2,read,size) == SERIAL_MSG_OK)
	{
	  pal_lld_setpad(PORT_C, PC_LED7);
	  osalThreadDelayMilliseconds(200);
	}
return 0;
}

My output looks like this. Lot of data are being missed on UART Transmission.

01
02
03
04
05
06
07
08
09
0a
0b
0c
0d
0e
0f
10
11
12
13
14
15
16
17
18
19
1a
1b
1c
1d
1e
1f
20
21
22
23
24
25
26
27
28
29
2a
2b
2c
2d
2e
2f
30
31
32
33
34
35
36
37
38
39
3a
3b
3c
3d
3e
3f
40
41
42
4c
64
7c
88
91
9b
a4
ae
b7
c0
ca
d3
dc
e7
f0
fa

After 0x42, I'm not receiving continuous stream of data, and much of the data are being missed in vain. Help me in debugging it.

Note:

  1. I have checked by transmitting uint32_t type data. Large portion of data is being skipped in this case as well.
  2. while debugging step by step, the tx interrupts are occurring correctly and I could retrieve without missing any data.

Thanks for your help in advance.

Prashanth Mohan

2 REPLIES 2
Erwan YVIN
ST Employee

Hello ,

Did you solve your issue ?

Have you tried to increase the stack size ?

Which device do you use ?

Best regards

Erwan

prashanth.mohan22
Associate III

Hi Erwan,

Yes the issue is solved, the problem is the system clock of the other end is slower than the transmitting clock, I used a little bit delay before transmission of each byte and now I could retrieve the data safely.

Thanks.

Prashanth Mohan