cancel
Showing results for 
Search instead for 
Did you mean: 

SPI + I2C Example Project

Linkpad
Associate III

Hi,

I am struggling to get SPI and I2C to work at the same time on my project I have tried multiple things (DMA, interrupts etc...) are there any example projects that already have this implemented? I am simply trying to read an I2C sensor value and show it on an SPI screen, as soon as I enable the SPI TFT the I2C returns zero values....

3 REPLIES 3
Pierre_Paris
ST Employee

Hello @Linkpad,

Thank you for your question !

Here some Remark :

  • What is your stm32F3 ?
  • Can you please share your code/configuration for SPI and I2C ? 
  • Are you using HAL_I2C_IsDeviceReady() and HAL_I2C_Mem_Read() function ? 
  • I2C returns zero values -> Is the function return an error or success code ?
  • Did you use the debug mode ? Have you scoped SDA and SCL ?

Best Regards,

Pierre

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Pierre,

Thanks for the advice what was happening in this case is the STM32F303K8 Discovery Board was pulling the I2C system low as soon as SPI was initiated, I swapped the project to an STM32F412G Discovery Board and the problem went away and is now working fine. I think some discovery boards have limitations on functionality (with jumper settings).

Thanks

Patrick

 

Billy OWEN
ST Employee

Hi @Linkpad 

 

The forum moderator had marked your post as needing a little more investigation and direct support. An online support case has been created on your behalf, please stand by for just a moment and you will hear from us.

 

Regards,

Billy