STM32F417 USB stop communicating
Hi,
First of all thanks for the answer.
I can see what you mean about race conditions but I don’t think this is my case because I would expact the USB to work part of the times on the same version of FW.
In my case I have one “old” version of FW where the USB works always and one “new” version which is the old one with changes where teh USB is not working always.
Also I am not using an RTOS.
Can you please explain what you mean in: “I myslef faces lock-up using teraterm and other terminal emulator when mixing and doing concurent rx/tx (f4 h/w)” (sorry but I am still a beginner at this).
pointer corruption is more possible and I will check it.
those are my uint8_t CDC_Transmit_FS and CDC_Receive_FS:
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
USBD_CDC_SetRxBuffer(hUsbDevice_0, &Buf0);
USBD_CDC_ReceivePacket(hUsbDevice_0);
memcpy(&USB_CDC_inBuffer,Buf,*Len);
newMessageExist = TRUE;
return (USBD_OK);
/* USER CODE END 6 */
}
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*)hUsbDevice_0->pClassData;
if (hcdc->TxState != 0){
return USBD_BUSY;
}
USBD_CDC_SetTxBuffer(hUsbDevice_0, Buf, Len);
result = USBD_CDC_TransmitPacket(hUsbDevice_0);
/* USER CODE END 7 */
return result;
}
Thanks again for the help,
Avner