2012-06-01 06:43 AM
Hello,
I am working on virtual serial port to communicate between computer and device through usb. So i downloaded ''STM32F105/7,STM32F2 and STM32F4 USB on-the-go Host and device library.'' from http://www.st.com/stonline/stappl/resourceSelector/app?page=resourceSelector&doctype=FIRMWARE&ClassID=1734 And i selected vcp from project lists, and start reading the code. I found that the main application only contains initialization of the hardware and the interrupts. So the code that is sending data is working in the interrupt, but i cannot find the portion that is responsible to send data... Please if any one can explain me the flow of the program. Note that i read the manuals from ST concerning this project but i didn't get the point, because they wrote 2 papers only about this application. Regards, Hisham2012-06-06 05:36 AM
While i am reading the data sheet of STM32F10xxx ''http://www.keil.com/dd/docs/DATASHTS/ST/STM32F10xxx.PDF'' i found that the NVIC of this series of microcontroller does not have interrupt vectors for OTG_HS_EP1_OUT_IRQHandler, and OTG_HS_EP1_IN_IRQHandler.
This is the interrupt that is enabled in vcp project:
void
USB_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev)
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#ifdef USE_USB_OTG_HS
NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_IRQn;
#else
NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_IRQn;
#endif
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
#ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_EP1_OUT_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_EP1_IN_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
#endif
}
From line number 15 to line number 30 this code will not be excuted since i am using STM32F107 and it does not contain interrupt vector for OUT and IN endpoints which are enabled.
So the only interrupt that can be enabled is
OTG_FS_IRQn
.
So now i am back to zero point, i don't know how to get and send data through usb.
Please share your ideas.
Regards,
Hisham
2013-09-16 12:23 PM
2013-09-30 03:23 AM