cancel
Showing results for 
Search instead for 
Did you mean: 

Sending large amount of data with STM32WB BLE

y.arikok
Associate II

I'm completely new to the embedded software and want to use STM32WB for my project, which will send image data from USART camera to the mobile phone. For now, I'm researching about BLE (protocols, characteristics etc.) and have no clue about how to use it. I've read the application note AN5289 and it didn't work well for me.

Where can I start researching?

What should I do?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Remi QUINTIN
ST Employee

​According to theoretical calculation , it is possible to achieve up to 97,600 bytes/s for 1 Mbps PHY on BLE 5. 96,000 bytes/s is a regular measurement done on our Nucleo board. It is possible to achieve high-speed data communications via the USART connection by using DMA.

There are a lot of presentation on the net regarding the BLE protocol.

You can start buying a STM32WB55 package on st.com web site and play with it using the CubeWB FW package available from the STM32WB web page here

https://www.st.com/en/embedded-software/stm32cubewb.html

You can of course use STM32CubeIDE.

We have also many application notes here: https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-wireless-mcus/stm32wb-series/stm32wbx5/stm32wb55rg.html#

View solution in original post

2 REPLIES 2
Remi QUINTIN
ST Employee

​According to theoretical calculation , it is possible to achieve up to 97,600 bytes/s for 1 Mbps PHY on BLE 5. 96,000 bytes/s is a regular measurement done on our Nucleo board. It is possible to achieve high-speed data communications via the USART connection by using DMA.

There are a lot of presentation on the net regarding the BLE protocol.

You can start buying a STM32WB55 package on st.com web site and play with it using the CubeWB FW package available from the STM32WB web page here

https://www.st.com/en/embedded-software/stm32cubewb.html

You can of course use STM32CubeIDE.

We have also many application notes here: https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-wireless-mcus/stm32wb-series/stm32wbx5/stm32wb55rg.html#

KMeld.1
Associate III

Hope its ok to "reopen" this question - it seemed the closest one to my issue.

I'm building a BLE application where I'm sampling >= 1024b at regular intervals (every x hrs) into an adc-buffer. After sampling I would like to transfer the whole buffer as fast and power-optimized as possible, so I can put BLE to sleep and wake it up for the next sampling cycle (using some hardware timer).

I can see the functions ACI_GATT_READ_LONG_CHAR_VALUE & ACI_GATT_WRITE_LONG_CHAR_VALUE exist but I'm not sure how to use them correctly. According to the BLE specs the maximum payload allowed is 247b.

The setup (software):

A custom p2p server with a characteristic (among other):

  • Value length = 128 (1024/8)
  • Length Characteristic = Constant
  • CHAR_PROP_READ = yes (other PROPs are false)
  • GATT_NOTIFY_ATTRIBUTE_WRITE = yes

Right now I've implemented (a very dirty) notification characteristic that kinda does the same:

static void vibration_sample_action(void){ /* Notify callback */
	if ((HAL_ADC_GetState(&hadc1) & HAL_ADC_STATE_REG_BUSY) != 0UL) {
		return;
	} else {
//		NotifyCharData[0] = Custom_App_Context.Sample_not_value.Value;
//		++Custom_App_Context.Sample_not_value.Value;
//		NotifyCharData[1] = Custom_App_Context.Sample_not_value.Value;
//		++Custom_App_Context.Sample_not_value.Value;
//
//		if (Custom_App_Context.Sample_not_value.Value > Custom_App_Context.Sample_not_value.Max){
//			// reset
//			Custom_App_Context.Sample_not_value.Value = Custom_App_Context.Sample_not_value.Min;
//		}
 
		// update buffer
			//split samples
		NotifyCharData[0] = (uint8_t)((an0_buffer[Custom_App_Context.Sample_not_value.cur_buf_idx] & 0xFF00 ) >> 8);
		NotifyCharData[1] = (uint8_t)(an0_buffer[Custom_App_Context.Sample_not_value.cur_buf_idx] & 0x00FF);
		// update char and notify client
		APP_DBG_MSG("\n ## NOTIFYING: VAL: %i\tIDX %i ##\n", an0_buffer[Custom_App_Context.Sample_not_value.cur_buf_idx], Custom_App_Context.Sample_not_value.cur_buf_idx);
		Custom_Vib_not_Send_Notification();
 
		++Custom_App_Context.Sample_not_value.cur_buf_idx;
		// restart sampling
		if (Custom_App_Context.Sample_not_value.cur_buf_idx > NUM_SAMPLES_TO_TRANSMIT){
			APP_DBG_MSG("\n ## NOTIFY RESTARTS ADC ##\n");
			Custom_App_Context.Sample_not_value.cur_buf_idx = 0;
			HAL_ADC_Start_DMA(&hadc1, (uint32_t*)an0_buffer, AN0_BUF_LEN);
		}
	}
}

There must be a better way to do it? Anyhow, I dont want to get samples continuously - only every hour or so.

Regards