Skip to main content
shangdawei1
Associate III
June 28, 2007
Question

USB and CAN

  • June 28, 2007
  • 6 replies
  • 1584 views
Posted on June 28, 2007 at 07:21

USB and CAN

    This topic has been closed for replies.

    6 replies

    shangdawei1
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:15

    Can i use both USB and CAN ? usb/can uses the same pins.

    how to use ?

    [ This message was edited by: shangdawei on 17-06-2007 13:33 ]

    16-32micros
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:15

    Hi shangdawei,

    If your application is not going to use USB and CAN simultaneously (at the same time) you can remap by software the CAN TX and RX pins (to PB8 & PB9 or PD0 & PD1) and design your board with separated pins (and connectors) for these two peripherals. But as I said, this is possible only when you are not using both of the USB and CAN at the same time : in fact, in the STM32 the USB and the CAN shares the same RAM memory for data reception and transmission. So it’s not possible to run both of these two communications peripherals at the same time.

    For more details about the alternate function software remapping please refer to the ''STM32F101xx and STM32F103xx advanced ARM-based 32-bit MCUs Reference manual'' section ''5.3 Alternate function I/O and debug Configuration (AFIO)''.

    With best regards

    STOne-32

    ben2
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:15

    it looks as if you can only use both in hte 64+ pin versions.

    see page 87 of the programming datasheet. IT explains about remapping CAN I/O

    ben2
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:15

    I would have to agree that according to the datasheet, they use different memory areas. Of course the datasheet may be wrong

    pav1
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:15

    Quote:

    On 19-06-2007 at 10:03, Anonymous wrote:

    Hi shangdawei,

    If your application is not going to use USB and CAN simultaneously (at the same time) you can remap by software the CAN TX and RX pins (to PB8 & PB9 or PD0 & PD1) and design your board with separated pins (and connectors) for these two peripherals. But as I said, this is possible only when you are not using both of the USB and CAN at the same time : in fact, in the STM32 the USB and the CAN shares the same RAM memory for data reception and transmission. So it’s not possible to run both of these two communications peripherals at the same time.

    For more details about the alternate function software remapping please refer to the ''STM32F101xx and STM32F103xx advanced ARM-based 32-bit MCUs Reference manual'' section ''5.3 Alternate function I/O and debug Configuration (AFIO)''.

    With best regards

    STOne-32

    I really do not see any sharing between CAN and USB memory areas. Can you give us more details? Thanks.

    USB - 5C00-63FF

    CAN - 6400-67FF

    [ This message was edited by: pavelixer on 27-06-2007 22:01 ]

    shangdawei1
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:15

    Thx a lot !