Skip to content
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

Support for RP2040 MCU #18083

Merged
merged 77 commits into from
Nov 3, 2021
Merged

Support for RP2040 MCU #18083

merged 77 commits into from
Nov 3, 2021

Conversation

vxj9800
Copy link
Contributor

@vxj9800 vxj9800 commented Aug 16, 2021

This is the continuation of the original pr #17966 because GitHub was not allowing to reopen the pr. The current branch is rebased to PX4/PX4-Autopilot:master as asked by the maintainers.

Describe problem solved by this pull request
Add PX4 base layer support for RP2040 MCU

Describe your solution
A good amount of base layer functions are almost ready. Timers are for buzzer, pwm in, rc in, etc. will be implemented soon.

Test data / coverage
Testing needs to be done to make current implementation bug free. Timers will be implemented after that.

dagar and others added 29 commits October 20, 2021 14:46
…y the necessary info in there to begin developing the px4 base layer
…ining instruction on how to add support for a new chip
…mpilation error of library -larch_hrt not found
…nctions to look similar to ones in nuttx's boards/raspberrypi-pico folder
…ard_critmon folder from stm32f3 to rp2040 because rp2040 doesn't have support for it
@vxj9800 vxj9800 marked this pull request as ready for review October 21, 2021 00:44
@dagar dagar merged commit ea1ae73 into PX4:master Nov 3, 2021
@vxj9800 vxj9800 deleted the rp2040-support branch May 30, 2022 15:51
Comment on lines +478 to +498
/**
* Fetch a never-wrapping absolute time value in microseconds from
* some arbitrary epoch shortly after system start.
*/
hrt_abstime hrt_absolute_time(void)
{
/* Taken from rp2040 datasheet pg. 558 */
uint32_t hi = rTIMERAWH;
uint32_t lo;

do {
lo = rTIMERAWL;
uint32_t next_hi = rTIMERAWH;

if (hi == next_hi) { break; }

hi = next_hi;
} while (true);

return ((uint64_t) hi << 32) | lo;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So cool that you literally had to implement the hrt_absoluate_time function haha @vxj9800

I was going through the PR as I was watching your talk on Youtube, super cool!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@junwoo091400 This was a great relief when I started working on this since the RP2040 has a dedicated 64-bit real-time timer. It made my life much easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants