|
Forum Index : Microcontroller and PC projects : 3rd UART via PIO
| Author | Message | ||||
| homa Guru Joined: 05/11/2021 Location: GermanyPosts: 531 |
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: AustraliaPosts: 2951 |
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: NetherlandsPosts: 5628 |
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 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |