Merging spi and ble_app_att_mtu_throughput

Hi, 

I'm struggling to use ble_app_att_mtu_throughput and spi. Some help? 

When I merge the two codes the main code (ble_app_att_mtu_throughput) doesn't work.

Thanks for your help

Parents Reply Children
  • Hi,

    Do you get any error during runtime? Please specify what you mean by doesn't work?

    regards

    Jared 

  • When I run just ble_app_att_mtu_throughput and I open the PuTTY terminals, I see "this board act as responder" and "this board act as tester.

    This doesn't happen when I add spi code. I open the two terminals and nothing happen, neither if I push the reset button on the nRF52832 boards

    It's clear I wrong something in the code. Do you have some Q&A related about?

    Thanks

  • This is the part of the spi code I added

    //-------- Configuration SPI----------------
    #define SPIS_INSTANCE 1 /**< SPIS instance index. */
    static const nrf_drv_spis_t spis = NRF_DRV_SPIS_INSTANCE(SPIS_INSTANCE); /**< SPIS instance. */
    
    #define PACKET_SIZE 244
    #define NUM_PACKETS 10
    
    static uint8_t m_tx_buf[PACKET_SIZE]; /**< TX buffer. */
    static uint8_t m_rx_buf[PACKET_SIZE]; /**< RX buffer. */
    static const uint8_t m_length = PACKET_SIZE; /**< Transfer length. */
    
    static volatile bool spis_xfer_done; /**< Flag used to indicate that SPIS instance completed the transfer. */
    
    /**
     * @brief SPIS user event handler.
     *
     * @param event
     */
    void spis_event_handler(nrf_drv_spis_event_t event) {
        if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) {
            spis_xfer_done = true;
            NRF_LOG_INFO("Transfer completed. Received: %s", (uint32_t)m_rx_buf);
        }
    }
    
    static void spis_init(void) {
        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;
        
        APP_ERROR_CHECK(nrf_drv_spis_init(&spis, &spis_config, spis_event_handler));
    }

    At the end I added spi_init() in the main()

Related