I saw Perry Hung's reworked usart code (recently committed in libmaple) but it lacks buffered transmit. Is there any particular reason the transmit is unbuffered? Any hardware gotchas maybe, or planned work I would interfere with if I implement my own? Cheers
Buffered serial TX
(3 posts) (3 voices)-
Posted 5 years ago #
-
My two cents ... The Arduino always had the serial transmit output "blocking"
Which means that the transmission of all serial characters will have to be completed
before the next instruction would be executed. So it doesn't matter if
the transmit buffer has 64 chars or one; the system will wait for serial transmit completion.If this was to change, the transmit buffer could spew out all the characters while
moving on to the next instruction. This could impact the operating system "overhead"
and could cause other instructions to fail due to both the receive and transmit interrupts banging and other device interrupts also impacting the Maple's operating system/overhead. The Arduino design team made sure that this would never happen.I should let Perry H comment on this one.
Posted 5 years ago # -
This is a great question, and one we have debated internally at length. The short answer is YES - buffered tx is coming. The only reason its not there in 0.0.6 is because we didnt have time to test it.
By default, serialusb is a blocking pipe, so its something of a moot issue for a buffered tx. But in nonblocking mode (which i prefer for myself for various reasons) its pretty essential. We can discuss implementation/rationale if you wish, but I just came to say there will be a ring buffer for serialusb tx. As for Serial Tx (not serial usb), we will likely have a similar blocking/nonblocking option. However, because the uart peripheral is tied to DMA, we get a tx buffer for free without implementing one....namely the DMA itself.
Posted 5 years ago #
Reply
You must log in to post.