TIMER_x documentation
Hi,
On RP2040, I'm using a timer event to trigger from core0 data capture in an ISR on core1.
setting up core1 in function run via multicore_launch_core1()
on core0 I trigger data capture
in the ISR , running on core1, turn it off
This doesn't really use the timer as such , it's just a hack to get core0 to trigger core1 without having to faff around with FIFOs on which I wasted far too much time and were a bit overkill for this simple task.
In the ref manual
I also find enums
these enums are and index into the IRQ table.
What I have trouble finding is what controls the period of these IRQs. Do they all fire every 1us once enabled?
The "4 alarms" do not appear to be part of the vocabulary of RP2040 manual. Neither is this anything to do with "sleeps", timers to not sleep the processor.
It seems there is some bleed over and confusion in this writing.
Where do I find the doc on the timing of these TIMER_IRQ_x events?
TIA.
On RP2040, I'm using a timer event to trigger from core0 data capture in an ISR on core1.
setting up core1 in function run via multicore_launch_core1()
Code: Select all
irq_set_exclusive_handler(TIMER_IRQ_1, &DATA_ISR);
irq_set_enabled(TIMER_IRQ_1, true); // enables hw timer and NVIC entry for this core1
Code: Select all
#define TIMER_NUM 1
#define TIMER_MASK (1<<TIMER_NUM)
Code: Select all
hw_set_bits(&timer_hw->intf, TIMER_MASK); // force trigger ISR on core1
Code: Select all
hw_clear_bits(&timer_hw->intf, TIMER_MASK); // disable in NVIC of core0
In the ref manual
So RP2040 only has one timer, set at 1MHz, which we probably don't want to mess with.4.1.27.1. Detailed Description
RP2040 only has one tick generator, and it is part of the watchdog hardware.
I also find enums
Code: Select all
TIMER_IRQ_0
....
TIMER_IRQ_3
What I have trouble finding is what controls the period of these IRQs. Do they all fire every 1us once enabled?
I know there are some utility fn in SDK which provide "alarms" and an alarm pool but I want find the doc on the processor.4.1.28.1. Detailed Description
The timer has 4 alarms, and can output a separate interrupt for each alarm. The alarms match on the lower 32 bits of
the 64 bit counter which means they can be fired a maximum of 2^32 microseconds into the future. This is equivalent
to:
• 2^32 ÷ 10^6: ~4295 seconds
• 4295 ÷ 60: ~72 minutes
The timer is expected to be used for short sleeps, if you want a longer alarm see the hardware_rtc functions.
The "4 alarms" do not appear to be part of the vocabulary of RP2040 manual. Neither is this anything to do with "sleeps", timers to not sleep the processor.
It seems there is some bleed over and confusion in this writing.
Where do I find the doc on the timing of these TIMER_IRQ_x events?
TIA.
Re: TIMER_x documentation
Look in RP2040 Datasheet:pie_face wrote: I know there are some utility fn in SDK which provide "alarms" and an alarm pool but I want find the doc on the processor.
The "4 alarms" do not appear to be part of the vocabulary of RP2040 manual. Neither is this anything to do with "sleeps", timers to not sleep the processor.
It seems there is some bleed over and confusion in this writing.
Where do I find the doc on the timing of these TIMER_IRQ_x events?
4.6. Timer
4.6.1. Overview
The system timer peripheral on RP2040 provides a global microsecond timebase for the system, and generates
interrupts based on this timebase. It supports the following features:
• A single 64-bit counter, incrementing once per microsecond
• This counter can be read from a pair of latching registers, for race-free reads over a 32-bit bus.
• Four alarms: match on the lower 32 bits of counter, IRQ on match.
...
4.6.3. Alarms
...
4.6.4. Programmer’s Model
... 4.6.4.4. Complete example using SDK
4.6.5. List of Registers
Re: TIMER_x documentation
OK, it does seem that this silly language is used in RP2040 doc too.
Looks like "alarm" is the new word for a comparator, though calling these intervals "sleeps" is still wrong because interrupts to NOT "sleep" the processor.
I'd prefer not have to juggle new terms for every version of a CPU. Other ARM cortex CPUs like STM do not have "alarms" and "sleeps", so I don't know why they come in here.
Anyway , thanks for the point, I have a clearer idea what this is now.
Looks like "alarm" is the new word for a comparator, though calling these intervals "sleeps" is still wrong because interrupts to NOT "sleep" the processor.
I'd prefer not have to juggle new terms for every version of a CPU. Other ARM cortex CPUs like STM do not have "alarms" and "sleeps", so I don't know why they come in here.
Anyway , thanks for the point, I have a clearer idea what this is now.
Re: TIMER_x documentation
It is used by sleep_ functions in SDK, sets an alarm, the go to sleep by WFE.
Maybe is used also by timeout functions but you have to check.
Yep, alarms are comparators.
I think you can use PWMs as well.
Maybe is used also by timeout functions but you have to check.
Yep, alarms are comparators.
I think you can use PWMs as well.
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion