This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to make communication between nordic and msp430 by spi interfaces?

Hi Team,

I am working on a project. It requires nordic chips (slaves) to communicate with msp430 (master). I use the nordic example SPIS as the initial code of the nordic part. And use the example SPI code as the initial code on msp430. I observe they can receive signals between them. But the content is wrong totally. I don't the reasons. So, Can you provide a example how to communicate with msp430 chips by spi interfaces?

Gaosheng

  • Hello,

    What SDK (nRF5 SDK or nRF Connect SDK) are you using, and what version?

    Since you didn't mention it, I'll take a guess, and you can correct me if you are using something else.

    I assume you are using the nRF5 SDK v17.1.0. Did you check out the SPIS example from SDK\examples\peripheral\spis\pca10056\blank\<your IDE>?

    in main(), where it initalizes the spis:

        nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG;
        spis_config.csn_pin               = APP_SPIS_CS_PIN;
        spis_config.miso_pin              = APP_SPIS_MISO_PIN;
        spis_config.mosi_pin              = APP_SPIS_MOSI_PIN;
        spis_config.sck_pin               = APP_SPIS_SCK_PIN;
    		spis_config.mode = 
    
        APP_ERROR_CHECK(nrf_drv_spis_init(&spis, &spis_config, spis_event_handler));

    the nrf_drv_spis_config_t  struct has a parameter called "nrf_spis_mode_t mode". Try the different modes to see whether your master is using a different mode than the default mode used by the nRF (NRF_SPIS_MODE_0) by testing these:

    typedef enum
    {
        NRF_SPIS_MODE_0, ///< SCK active high, sample on leading edge of clock.
        NRF_SPIS_MODE_1, ///< SCK active high, sample on trailing edge of clock.
        NRF_SPIS_MODE_2, ///< SCK active low, sample on leading edge of clock.
        NRF_SPIS_MODE_3  ///< SCK active low, sample on trailing edge of clock.
    } nrf_spis_mode_t;

    If that doesn't work, what frequency is the SPI from your master using?

    Best regards,

    Edvin

  • Hi Edvin,

    Thank you! As your reply, I have something to clear.

    1. I using nRF SDK 17.0.2, actually it integrates with nRF Mesh5.0. 

    2. I will try based on the examples you mentioned on 17.0.2 firstly.

    Best wishes,

    Gaosheng

  • Hi Edvin,

    I tried all modes, they all failed. In my project, the master's frequency is 16 MHz or 1 MHz.

    So, what's your advice?

    Best,

    Gaosheng

  • Hi Edvin,

    I am trying all methods, it still cannot work.  Could you help me?

    Best,

    Gaosheng

  • lgs said:
    In my project, the master's frequency is 16 MHz or 1 MHz.

    Out of those two, I would try 1MHz first, and if you get it working, then you can test 16MHz.

    What voltage is the SPI master using on the GPIOs? And what voltage output is your nRF52840 using on the GPIOs? You can check using the nRF Command Line Tools command:

    nrfjprog --memrd 0x10001304

    The value should correspond to something from this array

    Does it say FFFFFFFF? If so, your GPIOs are running on 1.8V. If you want to try to increase the GPIO voltage to 3.3v, try setting this manually using:

    nrfjprog --memwr 0x10001304 --val 0xFFFFFFFD

    and see if that helps. If it does, we can look into doing this from the application. 

    Best regards,

    Edvin

Related