2751 views|4 replies

19

Posts

4

Resources
The OP
 

AT91SAM7S256 serial port data loss [Copy link]

When the AT91SAM7S256 serial port receives instructions to send multiple frames of data, the last frame always loses two bytes of data! It is sent normally without serial port instructions, and no data is lost! The same instructions give different results! I am so depressed!
This post is from Microchip MCU

Latest reply

It seems that the owner hasn't been here for a long time.  Details Published on 2019-3-27 15:09
 

19

Posts

4

Resources
2
 
void send(unsigned int add_buf,unsigned int count) { //while(!((*AT91C_US1_CSR)&(1<<4)));//ENDTX=1·¢í ENDTX=0μè′y *AT91C_US1_TPR=add_buf; *AT91C_US1_TCR=count; *AT91C_US1_PTCR = AT91C_PDC_TXTEN; while(!((*AT91C_US1_CSR)&(1<<4)));//ENDTX=1·¢í ENDTX=0μè′y } void send_sz(unsigned char *dat, unsigned char count) { unsigned char i; for(i=0;i



Check your clock source. Is it accurate?

It seems that the owner hasn't been here for a long time.

Long time no see! This problem has been solved! You can close the post!!! The problem is a common conceptual error! The CPU instruction execution speed is fast, while the serial port transmits data at the baud rate! The main program has been tossing back and forth, and the serial port has not finished the data transmission, and the main program is tossing the serial port send buffer again! Coincidentally, the send buffer is reassigned! As a result, data is lost! The solution is to check whether all the data has been sent when the serial port sends it, and then perform other operations! This will cause waiting, and it is okay if there are not many tasks!

AT91SAM7S256 serial port data loss


This post is from Microchip MCU
 
 
 

196

Posts

0

Resources
3
 
Check your clock source. Is it accurate?
This post is from Microchip MCU
 
 
 

36

Posts

0

Resources
4
 
It seems that the owner hasn't been here for a long time.
This post is from Microchip MCU
 
Personal signature毛晓婕 13823541468 ATMEL深圳
 
 

19

Posts

4

Resources
5
 
Long time no see! This problem has been solved! You can close the post!!! The problem is a common conceptual error! The CPU instruction execution speed is fast, while the serial port transmits data at the baud rate! The main program has been tossing back and forth, and the serial port has not finished the data transmission, and the main program is tossing the serial port send buffer again! Coincidentally, the send buffer is reassigned! As a result, data is lost! The solution is to check whether all the data has been sent when the serial port sends it, and then perform other operations! This will cause waiting, and it is okay if there are not many tasks!
This post is from Microchip MCU
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list