Hi,
I discovered a bug (or at least a not expected behaviour) in rp2040's watchdog driver. At the driver initialization it calculates the LOAD register's value from the config's `lrl` value (delay in ms) with a certain formula coming from the PICO SDK, but at the reseting it directly applies the `lrl` value (delay in ms) and causes inconsistencies. I have a commit which fixes this, I wonder if you accept it somewhere as a PR or rather fix it yourself?
Here is the commit, it helps to understand what I am talking about: https://github.com/ChibiOS/ChibiOS/compare/master...zsigmondszilveszter:ChibiOS:pr/RP-WDG-bugfix
RP watchdog bug Topic is solved
-
- Posts: 12
- Joined: Mon Jun 14, 2021 5:42 pm
- Has thanked: 9 times
- Been thanked: 5 times
- Contact:
-
- Posts: 12
- Joined: Mon Jun 14, 2021 5:42 pm
- Has thanked: 9 times
- Been thanked: 5 times
- Contact:
Re: RP watchdog bug
Hi,
I am not that familiar with SVN. How and from where could I pull the code ?
Szilveszter
I am not that familiar with SVN. How and from where could I pull the code ?
Szilveszter
- FXCoder
- Posts: 382
- Joined: Sun Jun 12, 2016 4:10 am
- Location: Sydney, Australia
- Has thanked: 178 times
- Been thanked: 130 times
Re: RP watchdog bug
Here you go...
It will turn up on the GIT mirror also (whenever it syncs)
Also note there is now a patch submission site which can be found at…
https://review.chibios.org
It will turn up on the GIT mirror also (whenever it syncs)
Also note there is now a patch submission site which can be found at…
https://review.chibios.org
- Attachments
-
- RP_WDG.zip
- (2.9 KiB) Downloaded 12 times
-
- Posts: 12
- Joined: Mon Jun 14, 2021 5:42 pm
- Has thanked: 9 times
- Been thanked: 5 times
- Contact:
Re: RP watchdog bug
Code: Select all
../ChibiOS/os/hal/ports/RP/LLD/WDGv1/hal_wdg_lld.c: In function 'set_wdg_counter':
../ChibiOS/os/hal/ports/RP/LLD/WDGv1/hal_wdg_lld.c:55:19: error: 'wdgp' undeclared (first use in this function); did you mean 'wdgStop'?
55 | uint32_t time = wdgp->config->rlr;
| ^~~~
| wdgStop
The 'wdgp' has to be passed to the function or the global 'WDGD1' should be used.
-
- Posts: 12
- Joined: Mon Jun 14, 2021 5:42 pm
- Has thanked: 9 times
- Been thanked: 5 times
- Contact:
Re: RP watchdog bug
The watchdog driver also needs to set something in the the PSM's (Power-on State Machine) WDSEL register, otherwise the watchdog doesn't reset anything.
Something like this:
Here is my Commit for an example.
Something like this:
Code: Select all
// reset everything apart from ROSC and XOS
PSM->WDSEL = _u(0x1FFFC);
Here is my Commit for an example.
- FXCoder
- Posts: 382
- Joined: Sun Jun 12, 2016 4:10 am
- Location: Sydney, Australia
- Has thanked: 178 times
- Been thanked: 130 times
Re: RP watchdog bug
Thanks for working on this.
I will find my RP2040s and set up for test soon.
In the mean time here is an updated driver.
--
Bob
I will find my RP2040s and set up for test soon.
In the mean time here is an updated driver.
--
Bob
- Attachments
-
- RP_WDG.zip
- (3.01 KiB) Downloaded 11 times
-
- Posts: 12
- Joined: Mon Jun 14, 2021 5:42 pm
- Has thanked: 9 times
- Been thanked: 5 times
- Contact:
Who is online
Users browsing this forum: No registered users and 7 guests