STM32 - 2. SPI-Bus



  • Hi,
    I have an RFM69 and an MFRC522 card reader (with different SS) on the STM32. Unfortunately, the RFM has some problems as soon as the card reader is attached to the SPI.
    Now the STM32 has several SPI, unfortunately I lack some programming knowledge to change the source code of the affected libraries to change one to port 2.
    I have seen the example of the STM32 Arduino library, but I don't know how I could "incorporate" it into the mysensors.
    Maybe it's quite simple (if you know how)?
    greetings

    Hyx


  • Mod

    Hi @hyx, welcome to the forum!

    I have not tried it, but it might not be harder than adding

    #include <SPI.h>
    
    SPIClass SPI_2(2); //Create an SPI2 object.
    #define RFM69_SPI SPI_2
    

    before including MySensors.h

    And modify line 108 in https://github.com/mysensors/MySensors/blob/development/drivers/RFM69/new/RFM69_new.h so RFM69_SPI doesn't get redefined (add an ifndef around it).

    Reference: https://www.stm32duino.com/viewtopic.php?t=278

    An alternative (less elegant but maybe easier) could be to use softspi.



  • Hi,

    wow, quick answer.
    I'm on the way right now, I'm testing it Friday.
    (It would be a real shame to take softspi by this controller. 😉 )
    Thank you, hyx


Log in to reply
 

Suggested Topics

  • 4
  • 2
  • 9
  • 15
  • 9
  • 4

39
Online

11.4k
Users

11.1k
Topics

112.6k
Posts