This seems to have stalled:
and the datasheet says on pages 2899 - 2900 (functional description) and 2920 - 2932 (registers) that it's possible:
So in the interest of getting my project past this hurdle, how can I add for myself in a way that works with everything else:
I've looked at
Ignoring the complex logic and only following
Likewise to receive a break, expand the RX buffers from 8-bit to 16-bit (already done with 9-bit support) and remove the
Is that true?
And what prevents all of that from getting wiped out with the next Arduino update?
and the datasheet says on pages 2899 - 2900 (functional description) and 2920 - 2932 (registers) that it's possible:
So in the interest of getting my project past this hurdle, how can I add for myself in a way that works with everything else:
SerialX.configureBreak(...)sets or clears theBRK13bit in theSTATregister. All other bits in Table 49-2 on pages 2899 - 2900, also control other functions that should not be cobbered. Probably not needed at all, really. My receivers will work either way.SerialX.sendBreak()works just likeSerialX.write(...), except that it puts a break character in the buffer. Normal zero, but with the stop bits intentionally incorrect. Used to get a receiver's attention, or to separate packets, while continuing to fill the buffer with data to be sent after the break, without the code waiting for the break to actually happen.SerialX.sendIdle()works just likeSerialX.write(...), except that it puts an idle character in the buffer. No activity on TX for one character time. Used to create a delay, while continuing to fill the buffer with more data to be sent after the delay, without the code waiting for the delay to be over. More for completeness, really. My receivers won't need it, and it comes for free with the proposed solution below.SerialX.recvBreak()is non-blocking. Returns true if a break character has been received since the previous call, otherwise false.
sendBreak and sendIdle should also keep the transmitter active, if used with SerialX.transmitterEnable(pin).I've looked at
HardwareSerial.{h|cpp}, and seen that all single-character writes funnel into size_t HardwareSerialIMXRT::write9bit(uint32_t c), which is conveniently next to void HardwareSerialIMXRT::IRQHandler().int HardwareSerialIMXRT::read(void) is just before both.Ignoring the complex logic and only following
uint32_t c from write9bit through the buffers and to what looks to be the actual TX register, suggests that I can simply change the buffers from uint8_t to uint16_t (enable 9-bit support at the top of HardwareSerial.h, even though I'm only using 8-bit characters), and adjust the funnel to pass all 16 bits, with no other changes to the library, and then use the write function as usual except with the special-character flag in the upper bits per page 2932.Likewise to receive a break, expand the RX buffers from 8-bit to 16-bit (already done with 9-bit support) and remove the
& 0x3ff from both hardware reads (one each in read and IRQHandler), and then check the same flag in the upper bits that the otherwise-normal read function returns. Once checked, mask off the data myself.Is that true?
And what prevents all of that from getting wiped out with the next Arduino update?
Last edited: