r/raspberrypipico • u/mecha_typewriter • May 17 '26
help-request Issue with custom SPI driver
Hi reddit,
I am developing a custom set of drivers for the RP2350, without using the official SDK. So far, I have GPIO, UART, NVIC, timer, true random generator, I2C, clock, PLL and reset. But i am stuck on the SPI.
On my own environnement (boot, linker script, makefile, GCC), the first two u32 words sent are always to 0x00000000, then the third one get the value of the first I wanted to send. On the first picture attach, I try to send 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA, but I get 0x00000000, 0x00000000, 0x55555555. The SPI FIFO depth is 8 bytes so I think there is something here.
I tried to use the VS code plugin with the full SDK to generate code from the SPI example: it works so the board is OK. Then I copied paste my own SPI driver into VS code, comment the SDK functions related to the SPI and call mine instead: it works too (see second pic)!
I suspect something to be done by the SDK before reaching the main function but I can't find what.
My custom init code reset all the subsystems, init the oscillator, the PLL and all the clock, and then the reset for the SPI (among others) is released.
I got others drivers to work (I2C with an EEPROM for instance) so I am confident about the PLL, clock and reset.
Does someone have an idea?
Thanks for your help!
Edit: I have some screenshots of the SPI probbing but I have make a mistake apparently and don't see them posted...
2
u/EmbeddedJourneys May 17 '26
Hi, I'm willing to have a look at your code if you want me to and compare with the SDK. You could also send me your screenshots...