I made custom board based on Olimex STM32-P103 design, but for some reason USB not working.
From PC side ubuntu dmesg:
[84976.982545] usb 3-2.3: new full-speed USB device number 87 using xhci_hcd
[84976.985592] usb 3-2.3: Device not responding to set address.
[84977.190591] usb 3-2.3: Device not responding to set address.
[84977.391920] usb 3-2.3: device not accepting address 87, error -71
[84977.465420] usb 3-2.3: new full-speed USB device number 88 using xhci_hcd
[84977.468475] usb 3-2.3: Device not responding to set address.
[84977.674499] usb 3-2.3: Device not responding to set address.
[84977.875768] usb 3-2.3: device not accepting address 88, error -71
[84977.949290] usb 3-2.3: new full-speed USB device number 89 using xhci_hcd
[84977.952337] usb 3-2.3: Device not responding to set address.
[84978.158278] usb 3-2.3: Device not responding to set address.
[84978.359618] usb 3-2.3: device not accepting address 89, error -71
I found that USB isr handler ( I guess Vector90 ) not executed at all.
Only difference from Olimex STM32-P103 ( USB related ) that I moved signal USB DISC from PC11 to PA9
and USB PRESENT from PC4 to PA10.
Any ideas what may affect to this?
This is my board.h file:
Code: Select all
#ifndef _BOARD_H_
#define _BOARD_H_
/*
* Setup for the SAM reader board.
*/
/*
* Board identifier.
*/
#define BOARD_SAM_READER
#define BOARD_NAME "SAM reader"
/*
* Board frequencies.
*/
#define STM32_LSECLK 32768
#define STM32_HSECLK 8000000
/*
* MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
*/
#define STM32F10X_HD
/*
* IO pins assignments.
*/
#define GPIOA_USB_P 10
#define GPIOA_USB_DISC 9
#define GPIOB_LED_1 0
#define GPIOB_LED_2 1
/*
* I/O ports initial setup, this configuration is established soon after reset
* in the initialization code.
*
* The digits have the following meaning:
* 0 - Analog input.
* 1 - Push Pull output 10MHz.
* 2 - Push Pull output 2MHz.
* 3 - Push Pull output 50MHz.
* 4 - Digital input.
* 5 - Open Drain output 10MHz.
* 6 - Open Drain output 2MHz.
* 7 - Open Drain output 50MHz.
* 8 - Digital input with PullUp or PullDown resistor depending on ODR.
* 9 - Alternate Push Pull output 10MHz.
* A - Alternate Push Pull output 2MHz.
* B - Alternate Push Pull output 50MHz.
* C - Reserved.
* D - Alternate Open Drain output 10MHz.
* E - Alternate Open Drain output 2MHz.
* F - Alternate Open Drain output 50MHz.
* Please refer to the STM32 Reference Manual for details.
*/
/*
* Port A setup.
* Everything input with pull-up except:
* PA9 - Push Pull output (USB DISC).
* PA10 - Normal input (USB PRESENT).
* PA11 - Normal input (USB DM).
* PA12 - Normal input (USB DP).
*/
#define VAL_GPIOACRL 0x88888888 /* PA7...PA0 */
#define VAL_GPIOACRH 0x88844438 /* PA15...PA8 */
#define VAL_GPIOAODR 0xFFFFFFFF
/*
* Port B setup.
* Everything input with pull-up except:
* PB0 - Push Pull output (LED_1).
* PB1 - Push Pull output (LED_2).
* PB5 - Push Pull output (USART2 TX_ENABLE).
* PB6 - Alternate output (USART1 TX).
* PB7 - Normal input (USART1 RX).
* PB8,9 - Alternate open drain (I2C).
* PB10 - Alternate output (USART3 TX).
* PB11 - Normal input (USART3 RX).
* PB12 - Push Pull output (MMC SPI2 NSS).
* PB13 - Alternate output (MMC SPI2 SCK).
* PB14 - Normal input (MMC SPI2 MISO).
* PB15 - Alternate output (MMC SPI2 MOSI).
*/
#define VAL_GPIOBCRL 0x4B388833 /* PB7...PB0 */
#define VAL_GPIOBCRH 0xB4B34BEE /* PB15...PB8 */
#define VAL_GPIOBODR 0xFFFFFFFF
/*
* Port C setup.
* Everything input with pull-up except:
*/
#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */
#define VAL_GPIOCCRH 0x88888888 /* PC15...PC8 */
#define VAL_GPIOCODR 0xFFFFFFFF
/*
* Port D setup.
* Everything input with pull-up except:
* PD0 - Normal input (XTAL).
* PD1 - Normal input (XTAL).
*/
#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
#define VAL_GPIODODR 0xFFFFFFFF
/*
* Port E setup.
* Everything input with pull-up except:
*/
#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
#define VAL_GPIOEODR 0xFFFFFFFF
/*
* Port F setup.
* Everything input with pull-up except:
*/
#define VAL_GPIOFCRL 0x88888888 /* PE7...PE0 */
#define VAL_GPIOFCRH 0x88888888 /* PE15...PE8 */
#define VAL_GPIOFODR 0xFFFFFFFF
/*
* Port G setup.
* Everything input with pull-up except:
*/
#define VAL_GPIOGCRL 0x88888888 /* PE7...PE0 */
#define VAL_GPIOGCRH 0x88888888 /* PE15...PE8 */
#define VAL_GPIOGODR 0xFFFFFFFF
/*
* USB bus activation macro, required by the USB driver.
*/
#define usb_lld_connect_bus(usbp) palClearPad(GPIOA, GPIOA_USB_DISC)
/*
* USB bus de-activation macro, required by the USB driver.
*/
#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOA, GPIOA_USB_DISC)
#if !defined(_FROM_ASM_)
#ifdef __cplusplus
extern "C" {
#endif
void boardInit(void);
#ifdef __cplusplus
}
#endif
#endif /* _FROM_ASM_ */
#endif /* _BOARD_H_ */