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

how to setup the SysTick handler #532

Open
oldoldman opened this issue Aug 27, 2024 · 7 comments
Open

how to setup the SysTick handler #532

oldoldman opened this issue Aug 27, 2024 · 7 comments

Comments

@oldoldman
Copy link

oldoldman commented Aug 27, 2024

Hi guys,
I'm trying to setup SysTick handler on a picow board. What I konw roughly is

  1. Setup the SysTick by programming the syst_csr/syst_rvr registers
  2. Setup the IRQ handler by calling irq_set_enabled

When it comes to the irq_set_enabled, I have not idea of which irq number shoud I use. Any suggestion? Many thanks!

@lurch
Copy link
Contributor

lurch commented Aug 27, 2024

See here for a full list of interrupt numbers. (Or page 188 in https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf )

@oldoldman
Copy link
Author

I've found from here that if I "override" the isr_systick in crt0.s, the SysTick will work. So I guess the irq number of SysTick is SIO_IRQ_PROC0. Is there any doc about this?

@kilograham
Copy link
Contributor

kilograham commented Aug 27, 2024

So I guess the irq number of SysTick is SIO_IRQ_PROC0. Is there any doc about this?

No, this is not true. SysTick is not an interrupt, it is an exception

see here https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_exception/include/hardware/exception.h

@oldoldman
Copy link
Author

oldoldman commented Aug 28, 2024

But this is from the ARMv6-M arch doc
image
So SysTick is an interrupt. But it is not that important. And I must admit that what I guess is wrong. The exception number of SysTick is 15.

@kilograham
Copy link
Contributor

Ha; from the same document ;-)

image

but as you say, it doesn't matter, however from an API perspective, the SDK treats it like an exception rather than an external interrupt

@oldoldman
Copy link
Author

oldoldman commented Aug 28, 2024

In my understanding of the ARM doc, SysTick is a kind of interrupt and interrupt is a kind of exception. So they are used interchangably.

@kilograham
Copy link
Contributor

yeah, it is confusing, because it lives with the synchronous exceptions but acts like an interrupt, but doesn't have the regular NVIC controls like the rest of the interrupts. Anyways, my point was that the hardware_irq deals with the external interrupts (and has 0 based indexes for those)

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

No branches or pull requests

3 participants