Hi everyone,
I'm using a STPM33 on some of my boards with STM32F302 or STM32F303.
With RIOT OS and my driver, I'm facing issues with SPI :
- Either I do spi_acquire() in the init process of the driver (bad
practice) and everything works great. But after a while and only on some
boards, I get constant values out of my STPM33. When I perform a soft
(pm_reboot) or hard reset of the board, the values we get are correct again.
- If I do spi_acquire()/spi_release() before and after each transaction,
I get only constant values or 3-4 different values but always the sames.
I think the STPM33 doesn't even get initialized.
- On EVALSTPM33 (the evaluation board from ST), if I do
spi_acquire()/spi_release() before and after each transaction,
everything works great. My driver is ok.
Before switching to RIOT OS, I was using a driver written by a student
of my University based on ST HAL library. Everything was working very
well. No issue with STPM33 with this driver.
Here are the drivers to compare:
- Old driver `spi.c` file :
https://gist.github.com/Carton32/2ba95a6b064afe8e03e01fa58cda6682
Functions of interest are : "spi_stpm33_init()",
"spi_stpm33_writebytes()" and "spi_stpm33_readbytes()"
- New RIOT OS driver : https://github.com/Carton32/stpm3x
Functions of interest are in stpm3x/stpm3x.c : "stpm3x_init()",
"stpm3x_read_reg()", "stpm3x_write_reg()". *Warning* : this is the
version of the driver with spi_acquire()/spi_release() on each SPI
transaction. The version I'm using does a single spi_acquire() on line
80 and no spi_release() at all. This is the only way I've found to make
my driver works on my custom designed boards.
Does someone has any clue why my driver is failing when doing
spi_acquire()/spi_release() on each transaction with my board design ?
The only explanation I've found until now is that the hardware design
may be wrong because on the EVALSTPM33 everything works with the Github
version of the driver without changes. If the hardware is not the issue,
does someone know what could I change to make it works like it should ?
The initialization of old driver in "spi_stpm33_init()" makes me think
it could come also from here.
Thank you for your help
Best regards
Joël
_______________________________________________
users mailing list
users@riot-os.org
https://lists.riot-os.org/mailman/listinfo/users