Any example how to send data with USB PCD device at STM32F3?
Hi!
I have made a large research about USB PCD device and I want to send data from my STM32 and recieve data to my STM32.
I have found PCD Firmware driver API description here at heading 31.2.
Here are these functions. I assume that I first need to call the function HAL_PCD_DevConnect at startup when my STM32 want to connect to my computer.
But what type of functions should I use then? What address should I use?
I know that there a lot of parameter how to use USB CDC with STM32F3, but I'm using STM32F3 with USB PDC. It's a different API.
void STM32_PLC_USB_Connect(PCD_HandleTypeDef *hpcd) {
HAL_PCD_DevConnect(hpcd);
}
void STM32_PLC_USB_Disconnect(PCD_HandleTypeDef *hpcd) {
HAL_PCD_DevDisconnect(hpcd);
}
void STM32_PLC_USB_Set_Address(PCD_HandleTypeDef *hpcd, uint8_t address) {
HAL_PCD_SetAddress(hpcd, address);
}
uint32_t STM32_PLC_USB_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr){
return HAL_PCD_EP_GetRxCount(hpcd, ep_addr);
}
void STM32_PLC_USB_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len){
HAL_PCD_EP_Transmit(hpcd, ep_addr, pBuf, len);
}
void STM32_PLC_USB_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len){
HAL_PCD_EP_Receive(hpcd, ep_addr, pBuf, len);
}
void STM32_PLC_USB_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type){
HAL_PCD_EP_Open(hpcd, ep_addr, ep_mps, ep_type);
}
void STM32_PLC_USB_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr){
HAL_PCD_EP_Close(hpcd, ep_addr);
}
void STM32_PLC_USB_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr){
HAL_PCD_EP_Flush(hpcd, ep_addr);
}
void STM32_PLC_USB_Clear_Stall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr){
HAL_PCD_EP_ClrStall(hpcd, ep_addr);
}
void STM32_PLC_USB_Set_Stall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr){
HAL_PCD_EP_SetStall(hpcd, ep_addr);
}