N
N
Nickilanto2018-10-01 12:45:16
Atmel AVR
Nickilanto, 2018-10-01 12:45:16

Missing data on Uart?

The bottom line is, I send character-by-character data via UART to the board (specifically, this data: 00112233445566778899), after which the AVR should report on the receipt of this data (namely, bring this line back), and I get unknown game in the form of 0013445566778899, where they can I'll never know if these 4 unfortunate numbers disappear
if ((UCSRA & (1<<7)))
{
pacet[uartChecker]=UDR;
uartChecker++;
if (uartChecker == 20)
{
lng=strlen(pacet);
for (int t=0; t < uartChecker; t++) {
while ( !( UCSRA & (1<<5)) ) {}
UDR=pacet[t];
_delay_ms(1000);
}
uartChecker = 0;
}
}
Actually, here is the code, I receive data, when there are 20 characters, it sends them back, but apparently an unknown force does not allow sending 3,4 and 5 characters

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ks0, 2018-10-01
@Nickilanto

Maybe the timings are not maintained
In the sense that for the computer 9600 is maintained, but for the controller they are 9700, for example.
In the datasheet there is an allowable deviation of F_CPU/16/BAUD-1 from the whole
I recently caught a glitch when I tried to start at 4 MHz at 9600. Garbage fell into the terminal. I had to switch to 8 MHz.
In short, the initialization of the uart and the frequency of the controller in the studio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question