Following this PR #2958 pio_encoding fixes + added PIO_VERSION to platform_defs.h
it fixes #2946 hardware_pio: fix pio_encode_mov(pio_pindirs, ...) on RP2350
but it breaks other opcode encodings.
A simple test:
printf( "mov osr,x 0x%4X (should be 0xA0E1) pio_osr=0x%1X\n", pio_encode_mov(pio_osr, pio_x), pio_osr );
printf( "mov pindirs,x 0x%4X (should be 0xA061) pio_pindirs=0x%1X\n", pio_encode_mov(pio_pindirs, pio_x), pio_pindirs );
printf( "mov pindirs_mov,x 0x%4X (should be 0xA061) pio_pindirs_mov=0x%1X\n", pio_encode_mov(pio_pindirs_mov, pio_x), pio_pindirs_mov );
printf( "mov exec,x 0x%4X (should be 0xA081) pio_exec=0x%1X\n", pio_encode_mov(pio_exec, pio_x), pio_exec );
printf( "mov exec_mov,x 0x%4X (should be 0xA081) pio_exec_mov=0x%1X\n", pio_encode_mov(pio_exec_mov, pio_x), pio_exec_mov );
printf( "mov y,x 0x%4X (should be 0xA041) pio_y=0x%1X\n", pio_encode_mov(pio_y, pio_x), pio_y );
RP2350 SDK 2.3.0 results:
mov osr,x 0xA061 (should be 0xA0E1) pio_osr=0x7 << WRONG
mov pindirs,x 0xA061 (should be 0xA061) pio_pindirs=0x4 << OK
mov pindirs_mov,x 0xA061 (should be 0xA061) pio_pindirs_mov=0x3 << OK
mov exec,x 0xA061 (should be 0xA081) pio_exec=0x7 << WRONG
mov exec_mov,x 0xA061 (should be 0xA081) pio_exec_mov=0x4 << WRONG
mov y,x 0xA041 (should be 0xA041) pio_y=0x2 << OK
For comparison SDK 2.2.0
mov osr,x 0xA0E1 (should be 0xA0E1) pio_osr=0x7 << OK
mov pindirs,x 0xA081 (should be 0xA061) pio_pindirs=0x4 << WRONG
mov exec_mov,x 0xA081 (should be 0xA081) pio_exec_mov=0x4 << OK
mov y,x 0xA041 (should be 0xA041) pio_y=0x2 << OK
There are reports on forum that RP2040 is affected too: https://forums.raspberrypi.com/viewtopic.php?t=399120#p2380376
pio_encode_mov(pio_osr, pio_x) is actually generating mov exec,x
I think the problem arises from overlapping enum fields across different instructions, maybe separate enums (per instruction type) would be easier to manage.
Following this PR #2958 pio_encoding fixes + added PIO_VERSION to platform_defs.h
it fixes #2946 hardware_pio: fix pio_encode_mov(pio_pindirs, ...) on RP2350
but it breaks other opcode encodings.
A simple test:
RP2350 SDK 2.3.0 results:
For comparison SDK 2.2.0
There are reports on forum that RP2040 is affected too: https://forums.raspberrypi.com/viewtopic.php?t=399120#p2380376
pio_encode_mov(pio_osr, pio_x) is actually generating mov exec,x
I think the problem arises from overlapping enum fields across different instructions, maybe separate enums (per instruction type) would be easier to manage.