It seems the problem is not with GPIO26, as that can occur after that also.
It seems it is related to side_set pindirs function in PIO.
I use side_set for 3 bits and then the last pin is not actually changing direction. Pindir change works fine when using just "set pindirs", but this side_set pindir has bug in RP2350B ? Or where is the bug?
This pio code was used for the testing:And the c-code to set the machines:I only tested with base as 16-24, and verified behaviour from GPIO24-GPIO31. I also noticed that my call to pio_set_gpio_base gives always error, regardless in what step i put in the code.
It seems it is related to side_set pindirs function in PIO.
I use side_set for 3 bits and then the last pin is not actually changing direction. Pindir change works fine when using just "set pindirs", but this side_set pindir has bug in RP2350B ? Or where is the bug?
This pio code was used for the testing:
Code:
.program set_data.wrap_target mov isr, null set y, 0b1111 in Y,4 in Y,4 set y, 0b0000 in Y,4 in Y,4 mov osr, isr irq wait 1 out pins, 8 [30] nop [31] irq wait 1 nop [31] irq wait 1 out pins, 8 [30] nop [30] irq wait 1.wrap.program change_dir.SIDE_SET 3 OPT PINDIRS.wrap_target wait 1 irq 1 SET PINDIRS, 0b11111 side 0b111 wait 1 irq 1 SET PINDIRS, 0b00000 side 0b000.wrapCode:
PIO pio_0 = pio0; uint set_io_sm = 0; uint change_dir_sm = 1; uint addr_data_offset_for_set_data=pio_add_program(pio_0,&set_data_program); pio_sm_config addr_data_config_for_set_data = set_data_program_get_default_config(addr_data_offset_for_set_data); uint addr_data_offset_for_change_dir=pio_add_program(pio_0,&change_dir_program); pio_sm_config addr_data_config_for_change_dir = change_dir_program_get_default_config(addr_data_offset_for_change_dir); for (int i=16; i < 31; i++) { gpio_set_function(i, pio_get_funcsel(pio_0)); } sm_config_set_in_pins(&addr_data_config_for_set_data, 6); sm_config_set_in_shift(&addr_data_config_for_set_data,false,false,8); uint base_for_out_and_set_pins = 19; sm_config_set_out_pins(&addr_data_config_for_set_data, base_for_out_and_set_pins, 8); sm_config_set_out_shift(&addr_data_config_for_set_data, true,false,8); sm_config_set_set_pins(&addr_data_config_for_change_dir, base_for_out_and_set_pins, 5); sm_config_set_sideset(&addr_data_config_for_change_dir, 3, true, true); sm_config_set_sideset_pins(&addr_data_config_for_change_dir, base_for_out_and_set_pins+5); Code:
int ret_value = pio_set_gpio_base (pio_0, 0);Statistics: Posted by popolon — Wed Feb 05, 2025 10:51 pm