Skip to main content
dejan
Associate II
June 11, 2015
Question

STM32F4xx SPI2 and USB-HS conflict

  • June 11, 2015
  • 4 replies
  • 1202 views
Posted on June 12, 2015 at 01:26

I have been hit with an odd issue - we have a very complex board, using practically all of STM32F429 device's peripherals (Ethernet, USB HS device, SDCARD, I2C , SDRAM interface, 3 SPI channels...).

When USB HS (with external PHY - so DP and DM lines are not used) is attached to the PC, SPI2 MOSI line drops dead. It happens when the driver enables USB HS device on the chip. It looks like MOSI line gets disconnected from the SPI controller (it's driver operates in the background, clock output is toggling etc.). As soon as USB is disconnected and disabled, MOSI jumps to live again. I managed to create bare-bone example with only USB and SPI2 activated and checked various pin configurations for SPI2  - it only affectes MOSI when it's routed to PB15 (when routed to PC3 and PI3 it works).

I checked GPIOB configuration registers during USB operation and all seems to be OK

and not changed from original settings, so I have no idea how can PB15 be disabled.

According to datasheet, PB14 and PB15 are used for USBHS DP and DM lines, when internal PHY is selected, so I guess there must be some hardware bug that erroneously attahces PB15 to it (PB14 outputs SPI clock all the time) even when external PHY is enabled...

I also tested this on Keil's MCBSTM32F400 board with STM32F407 device - same thing. If anybody wants to try it out, I can post complete Keil project of that bare-bone example...

Any ideas?

    This topic has been closed for replies.

    4 replies

    dejan
    dejanAuthor
    Associate II
    June 12, 2015
    Posted on June 12, 2015 at 08:41

    Thanks for this hint, Jan. It works -USB driver erroneously enables internal HS PHY even when it is not used... I should notify Keil to update their Middleware USB driver.

    waclawek.jan
    Super User
    June 12, 2015
    Posted on June 12, 2015 at 08:54

    I'd still call it a silicon bug asking for at least an erratum - a peripheral is not supposed to override the GPIO AF setting unless carefully documented.

    Could you please submit this as a bug also to ST?

    JW

    nesrine
    Visitor II
    June 12, 2015
    Posted on June 12, 2015 at 17:01

    Curious to reproduce this case, could you please share your project?

    Thanks you

    Syrine