hwSPI NRF52



  • Hi

    I want to understand how the hwSPI works for the NRF52 and a RFM95 module.

    I suppose that I can define more then one SPI interface in the file MyBoardNRF5.h so it looks like
    SodaqMoja/SodaqCore-samd (should be updated to the NRF52 pins)

    #ifdef ENABLE_SPI1
    #define SPI_INTERFACES_COUNT 2
    #else
    #define SPI_INTERFACES_COUNT 1
    #endif
    
    // SPI
    #define PIN_SPI_MISO         (42u)
    #define PIN_SPI_SS           (43u)
    #define PIN_SPI_MOSI         (44u)
    #define PIN_SPI_SCK          (45u)
    
    static const uint8_t MISO = PIN_SPI_MISO;
    static const uint8_t SS   = PIN_SPI_SS ;
    static const uint8_t SS_DFLASH  = PIN_SPI_SS ;
    static const uint8_t MOSI = PIN_SPI_MOSI ;
    static const uint8_t SCK  = PIN_SPI_SCK ;
    
    // SPI1
    #define PIN_SPI1_MISO        (53u)
    #define PIN_SPI1_SS          (54u)
    #define PIN_SPI1_MOSI        (55u)
    #define PIN_SPI1_SCK         (56u)
    
    static const uint8_t MISO1 = PIN_SPI1_MISO;
    static const uint8_t SS1   = PIN_SPI1_SS;
    static const uint8_t MOSI1 = PIN_SPI1_MOSI;
    static const uint8_t SCK1  = PIN_SPI1_SCK;
    

    But I don't get how I will init the second SPI bus and point it to the RFM95 module. Guessing it should be define RFM95_SPI SPI1 or something like that?

    #if !defined(RFM95_SPI)
    #define RFM95_SPI hwSPI //!< default SPI
    #endif
    

 

248
Online

8.7k
Users

9.5k
Topics

99.9k
Posts