Sync PIO to 1us Counter Tick = "Nudge-lock"... plus RP2350 DMA question. #19927
|
More of my precise timing quest, seems this is getting quite in-depth. I'd like to sync my PIOs (running at full CPU speed) to the 1us counter tick. It does not seem that this is an easy task, but digging through the (RP2040) datasheet I might have a scheme. Please tell me if there is an easier way... It looks like the 1us Tick is created by the Watchdog module, from the REF_CLOCK which runs at 12MHz. Watchdog divides down by 12 and sends this Tick back to the Timer/Counter module. Unfortunately this is not exposed in a way to route/access from the PIOs. So, my scheme:
If the FIFO constantly reads back '12' this confirms that the CLOCK_GPOUT0 rising edge is aligned to the 1us Tick. Issues:
Script: Good run Bad run |
Replies: 2 comments 11 replies
There's an easier way! ;-) But not using the sluggish standard Python. Every call (mem32,…) takes ages. Instead write an tiny Viper function or even better an asm_thumb function. Stop the StateMachines, wait (in Assembler) for an increase of the systick and start the SMs. Done. |
|
An evening of bashing my head against the keyboard... what joy! I have a small script which points to a DMA issue with RP2350, it appears that it's triggering a read error. But I don't know why! |





This might be working now....