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,
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
If you add the CONFIG_BT_NUS_UART_BUFFER_SIZE parameter to your prj.cnf file you should be able to change the UART data size from the default 20 bytes to something larger.
Best regards
Torbjørn
Hi ovrebekk,
Have you check this
Hi
First off, I wouldn't recommend sending sensor data in ASCII format like this. It is much more efficient to send the raw data directly, and do the ASCII conversion on the phone side.
Then you get less data to send over BLE, and you get a consistent data length for each update.
Using 2M PHY and longer ATT MTU should speed up the throughput definitely. Have you had a look at the throughput example in the SDK for an idea of how to increase throughput?
Sunil vignesh said:CONFIG_BT_NUS_UART_BUFFER_SIZE = 500
is it possible
This should be possible, yes. In general characteristics can be up to 512 bytes in length, but using long characteristics like this is not always the most efficient since the packet might have to be split up into several smaller packets over the air (depending on the max data length setting).
Have you added any error handling to the function you use to send data, in order to check if it ever returns an error?
Best regards
Torbjørn
HI ,
following code line shows my data sending through NUS
length = sprintf(data, "\nx,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\ny,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\nz,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", (int16_t)mlx90393_config[0].reading[MLX90393_x],
(int16_t)mlx90393_config[1].reading[MLX90393_x],
(int16_t)mlx90393_config[2].reading[MLX90393_x],
(int16_t)mlx90393_config[3].reading[MLX90393_x],
(int16_t)mlx90393_config[4].reading[MLX90393_x],
(int16_t)mlx90393_config[5].reading[MLX90393_x],
(int16_t)mlx90393_config[6].reading[MLX90393_x],
(int16_t)mlx90393_config[7].reading[MLX90393_x],
(int16_t)mlx90393_config[8].reading[MLX90393_x],
(int16_t)mlx90393_config[9].reading[MLX90393_x],
(int16_t)mlx90393_config[0].reading[MLX90393_y],
(int16_t)mlx90393_config[1].reading[MLX90393_y],
(int16_t)mlx90393_config[2].reading[MLX90393_y],
(int16_t)mlx90393_config[3].reading[MLX90393_y],
(int16_t)mlx90393_config[4].reading[MLX90393_y],
(int16_t)mlx90393_config[5].reading[MLX90393_y],
(int16_t)mlx90393_config[6].reading[MLX90393_y],
(int16_t)mlx90393_config[7].reading[MLX90393_y],
(int16_t)mlx90393_config[8].reading[MLX90393_y],
(int16_t)mlx90393_config[9].reading[MLX90393_y],
(int16_t)mlx90393_config[0].reading[MLX90393_z],
(int16_t)mlx90393_config[1].reading[MLX90393_z],
(int16_t)mlx90393_config[2].reading[MLX90393_z],
(int16_t)mlx90393_config[3].reading[MLX90393_z],
(int16_t)mlx90393_config[4].reading[MLX90393_z],
(int16_t)mlx90393_config[5].reading[MLX90393_z],
(int16_t)mlx90393_config[6].reading[MLX90393_z],
(int16_t)mlx90393_config[7].reading[MLX90393_z],
(int16_t)mlx90393_config[8].reading[MLX90393_z],
(int16_t)mlx90393_config[9].reading[MLX90393_z]);
if (bt_nus_send(NULL, data, length)) {
LOG_WRN("Failed to send data over BLE connection");
}
How to send the raw data in NUS
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
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