2018-04-05 03:22 AM
Hi,
I'm trying make USB custom HID with stm32f302CB. I'm using Keil v5.23 and STM32CubeMX. The problem:
PC just don't recognize the USB, when i running in debug mode i saw something strange. Just after calling HAL_PCD_Init interrupt executing. In HAL_PCD_IRQHandler from there we go to HAL_PCD_ResetCallback. Thet calbek must config USB_EP0R register to config default endpoint. It perform by HAL_PCD_EP_Open. Ther are macros PCD_SET_EPTYPE thet write in USB_EPnR but in peripheral viewer they doesnt change. It's strange because others USB registers are writing normally. I'm trying write UART_EP0R by my own but it's doesn't work either. In RCC_APB1ENR USBEN is set.
Im trying to create same USB HID on STM32F407 Discovery with Keil and CubeMX and it works fine.
Does someone have an idea where the problem could be?
Solved! Go to Solution.
2019-02-04 01:34 AM
I find my problem. I was using some non recommended crystal ceramic resonator. Interesting that crystal ceramic resonator was generate swings and even my UART working on defined frequency. I think there was little frequency deviation and it was acceptable for UART but too big for USB.
2018-04-05 10:58 PM
Ther are macros PCD_SET_EPTYPE thet write in USB_EPnR but in peripheral viewer they doesnt change. It's strange because others USB registers are writing normally. I'm trying write UART_EP0R by my own but it's doesn't work either. In RCC_APB1ENR USBEN is set.
Look into the RM - some bits in this registers are rc_w0, which means you cannot write them to 1; others are t, which means that writing 0 has no effect and writing 1 toggles its value.
Your problem will be most probably somewhere else.
JW
2018-04-06 03:56 AM
Thanks for You'r advise but in reference manual in registers USB_EPnR are two rw bits EP TYPE that I traying to set, and it's doesnt work.
2018-04-07 08:43 AM
I know it's not in the RM, but I guess those bits are locked when the channel is enabled.
JW
2019-02-04 01:34 AM
I find my problem. I was using some non recommended crystal ceramic resonator. Interesting that crystal ceramic resonator was generate swings and even my UART working on defined frequency. I think there was little frequency deviation and it was acceptable for UART but too big for USB.