-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Bluetooth: Controller: DTM: Fix timer rollover #42866
Conversation
Thanks @piotrParf, can you please format the commit as per https://docs.zephyrproject.org/latest/contribute/index.html#commit-guidelines? |
/*Previous calculation in while loop can take too long time and can rollout the timer*/ | ||
if (t < s){ | ||
t+=((((s - t) / SCAN_INT_UNIT_US) + 1) * SCAN_INT_UNIT_US); |
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.
Please add roll over handling. Feel free to change the implementation for better readability.
/*Previous calculation in while loop can take too long time and can rollout the timer*/ | |
if (t < s){ | |
t+=((((s - t) / SCAN_INT_UNIT_US) + 1) * SCAN_INT_UNIT_US); | |
if (t < s) { | |
t += ((((s - t) / SCAN_INT_UNIT_US) + 1) * SCAN_INT_UNIT_US); | |
} else { | |
/* Handle rollover case here, timer is configured to 24-bits */ | |
t += ((((BIT(24) - t + s) / SCAN_INT_UNIT_US) + 1) * SCAN_INT_UNIT_US); |
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.
Please check my last commit @cvinayak. I made some refactoring of variables naming and also did another type of preventing the timer rollover.
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.
should be done
…ite big it can hapen that while loop will take a long time. This leads to setting up start of a radio timer before current timer value. This then leads to invocation of a timer after rollout and this will lead to very large delay in sending packet. It fixes for me a issue zephyrproject-rtos#42534. Signed-off-by: Piotr Parfeniuk piotr.parfeniuk@magitech.pl
445ecf9
to
1718515
Compare
…ted other type of timer rollover prevention. Signed-off-by: Piotr Parfeniuk piotr.parfeniuk@magitech.pl
Signed-off-by: Piotr Parfeniuk piotr.parfeniuk@magitech.pl
@piotrParf ping, can you take a look at the review comments please? |
Signed-off-by: Piotr Parfeniuk piotr.parfeniuk@magitech.pl
6b70dbf
to
a7d580a
Compare
Why do i got .github/labeler.yml Error: HttpError ? |
You can ignore that |
@KAGA164 could you please comment on this proposed change? |
@carlescufi I will check timings with Anritsu |
@piotrParf Please rebase and align your PR due to changes made by #42300. I included CTE time in the transmit time calculation. |
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.
@piotrParf I made PR with my proposal how to handle Tx timings in the DTM, Could you test it and give me a feedback ? #44735 |
For me it is many changes to 2.7.0 but it looks like it works when loaded with this controller to network core. |
superceded by #44735, closing based on authors reply. |
It changes the behaviour of while loop in lll_test.c in isr_tx() . When bug happens and t<s is quite big it can hapen that while loop will take a long time. This leads to setting up start of a radio timer before current timer value. This then leads to invocation of a timer after rollout and this will lead to very large delay in sending packet.
Fixes #42534.
Signed-off-by: Piotr Parfeniuk piotr.parfeniuk@magitech.pl