Skip to content

Commit

Permalink
32 bit SPI access fails on RPI5 so for now force 8 bit SPI mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pcw-mesa committed Nov 28, 2024
1 parent 8d3746f commit efbbe21
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions spi_boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ int spi_boards_init(board_access_t *access) {
}
spidev_set_lsb_first(sd, false);
spidev_set_mode(sd, 0);
if (spidev_set_bits_per_word(sd, settings.bits_per_word) < 0)
{
fprintf(stderr,"unable to set bpw32, fallback to bpw8\n");
// Either the following test fails on SPI5 or theres an issue with 32 bit SPI access
// so... disable 32 bit access for now.
// The cost of forcing 8 bit access is minor as it only slows flashing/verification.
// So, for now, just force 8 bit access for everyone.
// if ((spidev_set_bits_per_word(sd, settings.bits_per_word) < 0)
// {
// fprintf(stderr,"unable to set bpw32, fallback to bpw8\n");
canDo32 = false;
settings.bits_per_word = 8;
spidev_set_bits_per_word(sd, settings.bits_per_word);
}
// }
spidev_set_max_speed_hz(sd, settings.speed_hz);

return 0;
Expand Down

0 comments on commit efbbe21

Please sign in to comment.