-
Notifications
You must be signed in to change notification settings - Fork 579
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
os/arch/arm/src/amebasmart: Fix UART data loss when wakeup from PG #6497
base: master
Are you sure you want to change the base?
os/arch/arm/src/amebasmart: Fix UART data loss when wakeup from PG #6497
Conversation
f3c28a0
to
5998015
Compare
Please hold on merge, MAP and ASM file was not updated |
UART_TypeDef* uartx = UART_DEV_TABLE[uart_index_get(g_uart1priv.tx)].UARTx; | ||
|
||
/* prevent PM transition while fetching remainder FIFO */ | ||
pm_timedsuspend(pm_domain_register("UART_PG_WAKE"), 5000); |
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.
during uart bringup, a domain has been registered, how about refer to that pm id
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.
why 5000, any reason?
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.
So that the board can be observed to actually be awake for a short time and to ensure that anything in the FIFO is fully cleared
Also see tash_main.c it has been defined to 5000ms as well
@lhenry-realtek first commit of this PR shouldn't exist, please rebase it |
5998015
to
7742e37
Compare
bin file will be added after resolving conflicts on our side, do not merge yet |
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.
Could you please verify using below tools??
apps/examples/uart_loopback/uart_loopback.c
tools/uart_loopback_test/uart_loopback_test.py
apps/examples/power/power_main.c
TASH >> uart_loopback start
TASH >> power start
@lhenry-realtek Could you please let me know how many bps are supported? Based on a 16-byte FIFO: ??? |
Hi @ewoodev , |
memset(flag, 0, sizeof(flag)); | ||
memset(uart_data, 0, sizeof(uart_data)); |
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.
- Could you check performance difference between 0 initialization at variable define and memset like this?
- What is the
flag
usage in this function? - You add little bit heavy operation in suspend and resume. How does they affect sleep and wakeup time? Could you check them for before and after?
- when it enters sleep, before it takes xx ms, after yyms
- when it wakes up, before and after?
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.
- changed to = { 0 } initialization
- flag is used to check when the IPC operation has finished. In this case the KM4 side will transfer control back to CA32 after it has deinitialized UART1 on its side
- measurement in progress
ipc_req_msg.rsvd = (u32)flag; | ||
|
||
memset(flag, 0, sizeof(flag)); | ||
memset(uart_data, 0, sizeof(uart_data)); |
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.
uart_data type is u32, but memset is working in byte (u8).
Could you compare for
loop for each member set with 0 to memset?
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.
removed
@lhenry-realtek If this affects sleep and wakeup times, it has huge effect on several features. Could you check it ASAP? |
7742e37
to
aa6faed
Compare
I have found some bug in the logic, currently refactoring Initial measurement based on latest commit:
SMP add roughly 0.8ms when waking up, mainly due to waiting for core1 to stabilize Readings are taken from average of 10 samples per test |
@lhenry-realtek Thank you for sharing status. Let's talk this again with final result. |
db928a6
to
d17656f
Compare
Latest measurement (each reading is average of 10 samples) Base Commit: 646445f
Note: One shot 260 bytes test is done by sending 260 char size data at once into UART1 via Tera Term Flow:
Before PR
After PR
|
Hi @ewoodev I have run the tests
|
d17656f
to
2fb777b
Compare
bin/asm/map added |
@@ -1,5 +1,11 @@ | |||
/* == "version" + "Realtek git version" + "compile date" + "compile time" == */ | |||
|
|||
== version c7e8f3b164 2024/11/22-07:56:05 == |
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.
Could you check PR #6525 ? That also has a change on km0_km4_app. That is missing here.
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.
A rebase is needed, Hnery is working on that.
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.
It has been updated @sunghan-chang
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.
@lhenry-realtek @jwei5 changed them already. Need to update them again.
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.
Hi @sunghan-chang this bin also includes the changes made by @jwei5, it is safe to resolve with this set of files
2fb777b
to
fc81138
Compare
a08aee4
to
d2fc335
Compare
rebase 8b183fc |
the string is short... Please increase string size of test over than 128byte and test again |
test string: test string length: 260 delay: 0.2 (200ms), anything lower than this is too fast for 115200 and will overflow or the device does not wakeup in time
|
@lhenry-realtek As you know, the files were updated. Could you resolve the conflict? |
It will be rebased again. |
d2fc335
to
3f401d6
Compare
stress tested 260 char 0.2 delay |
Issue is encountered where bytes are lost on UART wakeup source during resume from sleep Test Requirements: Please ensure PR Samsung#6482 is applied before testing Analysis: - UART FIFO is started but not drained during resume. When the peripheral is initialized again, it causes the FIFO to also be cleared and cause data loss - Similarly if more than 64 bytes is passed in together, since there is no mechanism to drain the FIFO into RAM it will cause LSR overrun error This fix drains the FIFO first at KM4, then again at CA32 until it fully wake, then normal Tizen ISR handler resume operation - The drained buffer is also passed to application layer - Watchdog is used to monitor UART1 until the FIFO is completely drained
3f401d6
to
57f2e1a
Compare
Required: This commit requires #6482, please apply it as a patch if it is not already merged