2015-04-03 07:50 AM
What happens? I've created project in CubeMX, there - CDC virtual com port. So, this is function CDC_Transmit_FS() in usbd_cdc_if.c
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
/* USER CODE BEGIN 7 */
USBD_CDC_SetTxBuffer(hUsbDevice_0, Buf, Len);
result = USBD_CDC_TransmitPacket(hUsbDevice_0);
/* USER CODE END 7 */
return result;
}
So, I have button interrupt in main.c
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_12);
CDC_Transmit_FS(''Hello'',5);
for (int i = 0 ; i <1000000; i++);
CDC_Transmit_FS(''World'',5);
}
What happened when I press on button:
Serial port COM22 opened
Hello
Second word does not send! Why?
Board STM32F4discovery, CubeMX 4.7, Firmware package 1.5.0 - the latest for today.
#cdc #stm32 #stm32f4 #usb #vc
2015-04-04 06:24 AM
for (int i = 0 ; i <1000000; i++);
How
your compiler
interprets the
data type
int
as
16 bits or
32 bits
?2015-04-04 02:10 PM
Hello patr.k! I use IAR, and actually did not think about this - I've used this delay in blinking LED, so this leds to delay about 0.5 sec(and cannot check now, because I'm not at work((( . Even if there is overflow... Do you think this is a problem?
2015-04-23 08:08 AM
So, no suggestions?
2015-04-23 09:22 AM
2015-04-24 02:56 AM
Really! I've changed NVIC priority to 15 and this fixed this problem! Thank you!
2017-08-10 12:10 AM
So, calling CDC_Transmit_FS() from ISR is not recommended?
From CDC_Receive_FS(), on example?