hi all, thanks for giving me some leads.
I have looked at a Github repo that does a low level implementation:
https://github.com/RdMaxes/stm32f4_USB_VCPIt does compile with my appln code, so far so good and the appln works as usual.
However when I add the initialize USB driver to my main.c routine,
USBD_Init(&USB_OTG_dev,USB_OTG_FS_CORE_ID,&USR_desc,&USBD_CDC_cb,&USR_cb);
I got a compiler error related to instantiation of the USB object.
Error[Pe020]: identifier "USB_OTG_dev" is undefined D:\grbl_f405_3\grbl_f405_3\source\main.c 32
In my vector.c interrupt routine, I have stated the object but clearly something is wrong.
//-----------------------------------------------------------------------------
typedef void (*intfunc)(void);
typedef union
{
intfunc __fun;
void* __ptr;
} intvec_elem;
//-----------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
//-----------------------------------------------------------------------------
extern u32 __intvec_start__;
//-----------------------------------------------------------------------------
// Added for USB driver by Paul
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
extern uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev);
//-----------------------------------------------------------------------------
// Forward declarations
void __iar_program_start(void); // IAR startup code
//-----------------------------------------------------------------------------
#pragma optimize=none
//-----------------------------------------------------------------------------
void reset_handler(void)
{
SystemInit();
// Execute IAR startup code and start main()
__iar_program_start();
}
... etc
//-----------------------------------------------------------------------------
void hardfault_handler(void) etc...
Further down the vector settings...
.....
{default_handler}, // 82 CAN2_SCE
{OTG_FS_IRQHandler}, // 83 OTG_FS // Added for USB driver Paul OTG_FS_IRQHandler
{default_handler}, // 84 DMA2_Stream5
{default_handler}, // 85 DMA2_Stream6 SD-Card
{default_handler}, // 86 DMA2_Stream7 UART6 Downlink Tx DMA Stream
{USART6_IRQHandler}, // 87 USART6 UART6 Downlink Rx USART6_IRQHandler
.... etc
I believe that USB_OTG_dev need to be assigned with an unique handle id or number so the interrupt can be married to the USB Object... if I make any sense...
Okay any help would be appreciated since I am so close but still not out of the woods.
Of course I can still try other repos but with 1 error to solve it might be just a tiny jump to success.
Thx!