-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nrf5x: Fix assert test on SERIAL_RESERVED_CHAR_MATCH #6748
Conversation
@@ -1697,7 +1697,7 @@ void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_widt | |||
MBED_ASSERT(obj); | |||
MBED_ASSERT(rx_width == 8); | |||
MBED_ASSERT(rx_length < 256); | |||
MBED_ASSERT(char_match == SERIAL_RESERVED_CHAR_MATCH); | |||
MBED_ASSERT(char_match != SERIAL_RESERVED_CHAR_MATCH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not certain why it asserts even on the condition as it is ? As default value for char_match is this reserved character, thus if read without character match is used, then char_match contains reserved value (=not used) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good point, perhaps this assert needs to be just removed entirely... I haven't checked if anything similar exists in the previous nordic platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. I understand the rest of the parameters there to be checked (not supported length , width etc) but asserting on char match does not make sense to me. Please verify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assert is there to check that the default value (SERIAL_RESERVED_CHAR_MATCH) hasn't been changed.
The new serial driver doesn't support character matching since reception is handled by DMA which only stops once the buffer is full. |
That would explain that. No interrupt driver ? I would not expect to have DMA iwth character match thus if character match is selected, no dma involved ? Or that is also not possible thus that assert? |
Everything goes through the DMA now - |
Oh, the character match was a killer feature for me. :-( Assuming there's still an interrupt available on each char received (?) I suppose I can add the char match back in my app. |
Who do you think pushed for it initially? 😄 I didn't implement it since the DMA takes away the performance benefit and you already have the full buffer when you get the interrupt.
Yes, but the interrupt wont be per character but rather per full DMA buffer, which size you can configure. |
Oh, this will be a really big problem for receiving variable sized messages. My current project is porting from nrf51 to nrf52810, I'm working on filling out the 52810 support in mbed, it's a fantastic (cheap) chip. It needs to be able to receive and handle messages between 2 character and 20 character long, with a null terminator on each one. I've just been reading the uarte / easydma docs, I wasn't aware of it previously... I don't know how it's going to be possible to support variable length messaging... but yes I can see more the limitations and why you've implemented what you have! |
b60c397
to
627d028
Compare
Ah, sorry, there is a timeout to flush the buffer so even if you only get 1 character you'll still get the interrupt so it should be straight forward to handle variable length messages. |
Oh really, I didn't see any reference to a timeout (haven't looked deep/close enough clearly). |
/morph build |
Build : SUCCESSBuild number : 1867 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1514 |
Test : FAILUREBuild number : 1678 |
@LMESTM The above failure, can you reproduce locally? I noticed it in the last days in some CI runs /morph test |
Test : SUCCESSBuild number : 1684 |
I wouldn't do anything with the other micro just yet. There is a very generous (and configurable) atomic fifo between Once you get an interrupt, it is either because the DMA buffer is full or the other micro is done sending. Just read out all characters in the fifo whenever you get an interrupt and you shouldn't miss any data. |
Description
I'm migrating an existing project to the recently-merged nrf52 / sdk 14.2 codebase in master.
I use a uart serial with match character for automatic depacketizing.
On current master I now get an assert fail as it's testing that
char_match == SERIAL_RESERVED_CHAR_MATCH
where I believe it should be the opposite;char_match
should not be allowed to beSERIAL_RESERVED_CHAR_MATCH
This is with GCC and the debug.json build profile.
Pull request type