Skip to main content
steve3
Associate
September 19, 2008
Question

CAN

  • September 19, 2008
  • 8 replies
  • 1842 views
Posted on September 19, 2008 at 04:35

CAN

    This topic has been closed for replies.

    8 replies

    smart
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:38

    see this...

    http://www.st.com/mcu/forums-cat-6876-23.html

    steve3
    steve3Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:38

    Hello all,

    Has anyone got the ST sample code for the STM32F10X-12K-EVAL board working. By which I mean remapping the alt function to PD0, PD1, correcting the baud rate calculations, and with CAN_Mode=CAN_Mode_Normal, and actually receiving data on the bus?

    If you have then I would greatly appreciate seeing the working code.

    Regards

    Steve

    steve3
    steve3Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:38

    Yahoo, I can now TX and RX.

    Problems were all in the ST sample code.

    1)Baud rate calculations

    2)Flash latency not set up correctly

    3)AF clocks not enabled

    Soon le weekend

    steve3
    steve3Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:38

    I look again...

    One problem solved, I was not enabling alt function clock, now that I do, I do not kill the bus signal when I have TX as AF_PP.

    But I still do not receive

    Steve

    steve3
    steve3Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:38

    Thanks for your reply. Yes I've read that with interest, I'm doing all these things, Baud rate correction, remap pins, can clock, port D clock.

    I notice that when the TX pin is set up as AF_PP it outputs a 0, which seems to silence the can bus, CAN H goes and remains high, which does not look right to me. I'm only trying to receive data, so I cna configure the pin as input pullup, then the CAN signals continue, but I get no RX.

    I'm puzzeled.

    Steve

    chesneje
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:38

    Hi,

    I have the same problem. Can you send me your configuration code.

    Thanks.

    jussi
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:38

    Hello,

    Suprisingly I'm having same problem...

    Is this flash latency set up relevant and if so how it's done?

    I just keep wondering how ST releases this kind of example code.. :-[

    -Jussi

    muhammaduzairafzal45
    Associate III
    December 19, 2012
    Posted on December 19, 2012 at 14:53

    working code of mine:

    [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20CAN%20Filter&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx&currentviews=4]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20CAN%20Filter&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx&currentviews=4

    Just change  CAN_InitStructure.CAN_Mode value to CAN_Mode_Normal to communicate

    externally. Correct Baud rate setting is very important for CAN..small mistake in calculating it

    might result in communication error.