2022-12-28 05:57 AM
char *data = "Hello World";
while (1) {
HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
HAL_Delay(1000);
CDC_Transmit_FS((uint8_t*)data,strlen(data)); }
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
/* USER CODE BEGIN 7 */
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
if (hcdc->TxState != 0){
return USBD_BUSY;
}
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
/* USER CODE END 7 */
return result;
}
I'm trying to transmit MPU6050 sensor readings to my computer via virtual comport.I'm using STM32 Nucleo F446RE. As far as i can see in debug mode there is no issue in sensor and sensor readings. Problem is I can't transmit them using USB. Are there anyone who have experienced this issue before?
2022-12-28 06:04 AM