pio.h: sm_config_set_sideset(): bad assertion #96

Closed
opened 2021-02-07 17:00:49 -06:00 by soundpaint · 2 comments
soundpaint commented 2021-02-07 17:00:49 -06:00 (Migrated from github.com)

pio.h says:

static inline void sm_config_set_sideset(pio_sm_config *c, uint bit_count, bool optional, bool pindirs) {
assert(bit_count <= 32);
c->pinctrl = (c->pinctrl & ~PIO_SM0_PINCTRL_SIDESET_COUNT_BITS) |
(bit_count << PIO_SM0_PINCTRL_SIDESET_COUNT_LSB);

However, according to RP2040 datasheet, table 397, SIDESET_COUNT occupies bits 31:29, that is only 3 bits, not 5. That is, the maximum valid value is 7, not 32.

pio.h says: static inline void sm_config_set_sideset(pio_sm_config *c, uint bit_count, bool optional, bool pindirs) { assert(bit_count <= 32); c->pinctrl = (c->pinctrl & ~PIO_SM0_PINCTRL_SIDESET_COUNT_BITS) | (bit_count << PIO_SM0_PINCTRL_SIDESET_COUNT_LSB); However, according to RP2040 datasheet, table 397, SIDESET_COUNT occupies bits 31:29, that is only 3 bits, not 5. That is, the maximum valid value is 7, not 32.
lurch commented 2021-02-08 08:55:12 -06:00 (Migrated from github.com)

Yeah, PIO_SM0_PINCTRL_SIDESET_COUNT_BITS is defined in hardware/regs/pio.h as 0xe0000000 which is 11100000000000000000000000000000 in binary, i.e. just the top 3 bits.

Fancy submitting a PR against the develop branch?

Yeah, `PIO_SM0_PINCTRL_SIDESET_COUNT_BITS` is defined in `hardware/regs/pio.h` as `0xe0000000` which is `11100000000000000000000000000000` in binary, i.e. just the top 3 bits. Fancy submitting a PR against the `develop` branch?
Wren6991 commented 2021-02-12 06:54:08 -06:00 (Migrated from github.com)

Fixed by #105

Fixed by #105
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#96
No description provided.