Skip to content

Conversation

@bikeNomad
Copy link
Contributor

If you call rp2.StateMachine.init() with pull_thresh=32 it will overwrite the FJOIN_TX bit in the SMx_SHIFTCTRL register. This PR fixes that issue.

Summary

I had a PIO program in which the RXFIFO was not working. I traced it down to asm_pio_override_shiftctrl() shifting the high bit of my pull_thresh argument of 32 into the adjoining bit 30 (FJOIN_TX) of the SMx_SHIFTCTRL register. A threshold of 32 should be encoded as a 0 in bits 29:25 of this register.

This PR uses the bit mask provided as an argument to asm_pio_override_shiftctrl() to ensure that bits outside the field don't get stepped on.

Testing

I tested this with an RP2350 board and a Segger JLINK to ensure that the values in the register were correct.

If you call rp2.StateMachine.init() with pull_thresh=32
it will overwrite the FJOIN_TX bit
in the SMx_SHIFTCTRL register. This PR fixes that issue.

Signed-off-by: Ned Konz <[email protected]>
@github-actions
Copy link

Code size report:

Reference:  mpy-cross/mpconfigport: Explicitly disable native code loading. [8fb848f]
Comparison: rp2: Correct bit access for rp2_state_machine_init. [merge of b683ec2]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants