i assume that both avr and stm are sending 9 bit (8 bit + 1 parity) and 1 start and stop bits?
another thing is to check the CR2 register as the stop bits setup is in the CR2 register
according to RM0008 there are several choices
Code: Select all
Bits 13:12 STOP: STOP bits
These bits are used for programming the stop bits.
00: 1 Stop bit
01: 0.5 Stop bit
10: 2 Stop bits
11: 1.5 Stop bit
The 0.5 Stop bit and 1.5 Stop bit are not available for UART4 & UART5.
so just in case it is sending 2 stops instead of the default 1 stop bit, you may like to check CR2 if it is indeed the case
you may like to try using, the buffer write call for the uart e.g.
Serial2.write(buffer, size);
instead of
Serial2.write(byte)
by putting all the bytes that you want to send in the buffer it could possibly queue up all the bytes end to end without gaps
i think the implementation works by sending the next byte as soon as one byte is transmitted. possibly interrupt driven.
normally, this shouldn't have an issue as stm32 runs in the mhz ranges.
but if you insert one byte in the queue, interleaving between bytes in Serial2.write(byte), it could possibly cause gaps
you may also like to try the libmaple core, but as it goes libmaple core is a community core
and if the line discipline flags are not handled, you may be left with setting the registers.
libmaple core isn't as feature packed (or even complete) as the official core. but few reasons i stuck with it is it is very lean. binaries tend to be rather small, i got myself a little more familiar with the codes, they seemed slightly simplier than the official core. so you may like to check that out.
i tend to patch the (libmaple) core to get the features i wanted, but those are custom and are not necessarily committed in the community core as it may not be relevant to others.