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
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
Hi,
Does the merged code build without any errors?
regards
Jared
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()
Sorry if I wasn't so clear. I'll try to clarify now.
My purpose is to assest a system with a communication by BLE with two nRF52832. I modified the example code ble_app_att_mtu_throughput to send 244 bytes packets. Now my object is to maintain the BLE communication but the data, instead to be create by a function in main (which create numbers from 0 to 243), are created and sent via SPI. This is the code I created with Python for my SPI Driver:
from spidriver import SPIDriver def main(): # Initialize the SPI Driver on the right COM try: sd = SPIDriver('COM5') print("SPI Driver correctly initialized") except Exception as e: print(f"ERROR") return # Creating data packet data_packet = bytearray(range(244)) # Creating a packet from 0 to 243 print("Packet created:", data_packet) # Sending the packet via SPI try: sd.sel() # Select your SPI device (CS down) sd.write(data_packet) # Sending data packet sd.unsel() # Deselect SPI device (CS up) print("Data packet sent correctly") except Exception as e: print(f"ERROR") if __name__ == "__main__": main()
Thanks
Sorry if I wasn't so clear. I'll try to clarify now.
My purpose is to assest a system with a communication by BLE with two nRF52832. I modified the example code ble_app_att_mtu_throughput to send 244 bytes packets. Now my object is to maintain the BLE communication but the data, instead to be create by a function in main (which create numbers from 0 to 243), are created and sent via SPI. This is the code I created with Python for my SPI Driver:
from spidriver import SPIDriver def main(): # Initialize the SPI Driver on the right COM try: sd = SPIDriver('COM5') print("SPI Driver correctly initialized") except Exception as e: print(f"ERROR") return # Creating data packet data_packet = bytearray(range(244)) # Creating a packet from 0 to 243 print("Packet created:", data_packet) # Sending the packet via SPI try: sd.sel() # Select your SPI device (CS down) sd.write(data_packet) # Sending data packet sd.unsel() # Deselect SPI device (CS up) print("Data packet sent correctly") except Exception as e: print(f"ERROR") if __name__ == "__main__": main()
Thanks