Skip to main content
Graduate
December 29, 2023
Question

SPI + I2C Example Project

  • December 29, 2023
  • 2 replies
  • 1424 views

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....

    This topic has been closed for replies.

    2 replies

    ST Employee
    January 2, 2024

    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

    LinkpadAuthor
    Graduate
    January 2, 2024

    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

     

    ST Employee
    January 2, 2024

    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