Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
T

thom4s

@thom4s
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • [SOLVED] STM32F103C8T6 bluepill clone - RFM69HW SPI port 1 and ILI9341 SPI port 2 not working together
    T thom4s

    I will answer to myself. Problem were in wrong definition of IRQ pin in sketch. But, as I found out STM32F103C8T6 has SPI 1 running on 72MHz (for SPI max 72/2 = 36MHz) and SPI 2 36MHz (for SPI max 36/2 = 18MHz) so it were a stupid idea to wire TFT display to SPI 2 port which is slower than SPI 1 with RFM69HW which doesnt need so fast SPI. Therefore I switched radio to SPI-2 and TFT display to faster SPI-1.

    Radio SPI-2 and TFT ILI9341 SPI-1 wiring

    // RFM69HW radio on SPI-2 
    //
    // CS / NSS   - PB12
    // DI00 / IRQ - PA8
    // SCK        - PB13
    // MISO       - PB14
    // MOSI       - PB15
    
    // TFT DISPLAY ili9341 on SPI-1
    //
    // CS         - PA4
    // RESET /RST - PA2
    // DC / RS    - PA3
    // SCK        - PA5
    // MISO       - PA6
    // MOSI       - PA7
    

    Add to sketch before #include <MySensors.h>

    #define MY_RFM69_NEW_DRIVER
    #define MY_RFM69_IRQ_PIN PA8
    #define MY_RFM69_IRQ_NUM PA8
    #define MY_RFM69_CS_PIN PB12
    #define MY_RFM69_STM32F103_SPI2
    //#define MY_RFM69_SPI_SPEED (18*1000000ul) //When SPI-2 speed needs to be reduced
    
    //Possible speeds on SPI 2 for RFM69HW:
    //
    //SPI_CLOCK_DIV2 = 36 / 2 = 18 MHz
    //SPI_CLOCK_DIV4 = 36 / 4 = 9 MHz
    //SPI_CLOCK_DIV8 = 36 / 8 = 4.5 MHz
    //SPI_CLOCK_DIV16 = 36 / 16 = 2.25 MHz
    //SPI_CLOCK_DIV32 = 36 / 32 = 1.125 MHz
    

    As you can see there is a new defined parameter MY_RFM69_STM32F103_SPI2 so if we want to use SPI 2 then modification of RFM69_new.h is needed.

    Edit file: MySensors-master/hal/transport/RFM69/driver/new/RFM69_new.h

    Add following lines after line 112 (after #include <SPI.h>)

    #if defined(MY_RFM69_STM32F103_SPI2)
    SPIClass SPI_2(2);
    #define RFM69_SPI SPI_2
    #endif

    Modified RFM69_new.h should looks like:

    #if defined(ARDUINO) && !defined(__arm__) && !defined(RFM69_SPI)
    #include <SPI.h>
    #if defined(MY_SOFTSPI)
    SoftSPI<MY_SOFT_SPI_MISO_PIN, MY_SOFT_SPI_MOSI_PIN, MY_SOFT_SPI_SCK_PIN, RFM69_SPI_DATA_MODE>RFM69_SPI;
    #else
    #define RFM69_SPI SPI
    #endif
    #else
    #if defined(__arm__) || defined(__linux__)
    #include <SPI.h>
    #if defined(MY_RFM69_STM32F103_SPI2)  //!<  ADD THIS AFTER LINE 112
    SPIClass  SPI_2(2);                   //!<  ADD THIS AFTER LINE 112
    #define RFM69_SPI SPI_2               //!<  ADD THIS AFTER LINE 112
    #endif                                //!<  ADD THIS AFTER LINE 112
    #else
    extern HardwareSPI SPI;		//!< SPI
    #endif
    #if !defined(RFM69_SPI)
    #define RFM69_SPI SPI		//!< SPI
    #endif
    #endif
    
    Hardware
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular