Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:01 24 Jan 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : 3rd UART via PIO

     Page 4 of 4    
Author Message
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 531
Posted: 09:10pm 10 Dec 2025
Copy link to clipboard 
Print this post

What am I doing wrong?

[135] Print Pio(readfifo 0, 0, 0)
Error : Invalid syntax


PIO(READFIFO a, b, c)
Read from a PIO FIFO
‘a’ is the pio (0 or 1), ‘b’ id the state machine (0...3), ‘c’ is the FIFO register
*0…3)
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2951
Posted: 11:03pm 10 Dec 2025
Copy link to clipboard 
Print this post

The example in the manual suggests that should work.
for i=0 to 3 'read the 4 FIFO registers to see if the program works
 print i,hex$(pio(readfifo 1,0,i))
next
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5628
Posted: 08:09am 11 Dec 2025
Copy link to clipboard 
Print this post

Hi Homa,

On both the RP2040 and RP2350 the PIO has FIFO's. The data in these FIFO's is shifter first in - first out. There is no way to address individual data in the FIFO. Simply read n 32 bit words, and the order is fixed.

The COMMAND that performs this action is PIO READ (see user manual).

On the RP2350 only (not RP2040) the FIFO can be configured as a set of 4 individual 32 bit registers (through PIO(SHIFTCTRL 0,0,0,0,0,0,0,0,r,t) parameters 9 and 10 set to 0 or 1). The PIO program for the 2350 has special commands to support these registers (not PUSH/PULL but special MOV instructions).

Then MMBasic can read a single individual register from this (previous) fifo using the MMBasic function PIO(READFIFO pio,sm,register).
But only on RP2350, and only after you have enabled this function in PIO SHIFTCTRL, and you use the correct PIO instructions in the PIO program. This is EXAMPLE 4 in the user manual.

Regards,

Volhout

P.S. if you use PIO CONFIGURE, these are the last 2 parameters in the configuration.
PIO Configure pio, sm, clock, startaddress,
'sidesetbase, sidesetno, sidesetout,
'setbase, setno, setout, outbase, outno, outout, inbase,
'jmppin, wraptarget, wrap, sideenable, sidepindir,
'pushthreshold, pullthreshold, autopush, autopull, inshiftdir, outshiftdir,
'joinrxfifo, jointxfifo, joinrxfifoget, joinrxfifoput


P.P.S. The PIO CONFIGURE has preference over PIO INIT MACHINE since it better supports the RP2350B (more IO pins on banks) chip.
Edited 2025-12-11 18:16 by Volhout
PicomiteVGA PETSCII ROBOTS
 
     Page 4 of 4    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026