This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE NUS data not sending > 20bytes

Hi,

I have tested the ble_nus code in NCS v1.4.2

where i can't send 250 bytes

I want to send 250 bytes to ble nus data send for 100 ms once

How to enable data send of 250 bytes 100ms once

  • Hi 

    One way to do this is to create a union, similar to this:

    #define NUM_SENSORS 10
    #define NUM_AXIS    3
    
    typedef union
    {
    	int16_t mlx_reading[NUM_SENSORS][NUM_AXIS];
    	uint8_t raw_buffer[NUM_SENSORS * NUM_AXIS * sizeof(int16_t)];
    } my_compound_type_t;

    Then you can simply refer to the mlx_reading array when you assign the values from the sensor, and then refer to the raw_buffer when sending the data to the NUS service. 

    Because it is a union the mlx_reading array and the raw_buffer array will use the same area in RAM. 

    Best regards
    Torbjørn

Related