Skip to main content
Alejandro Bizzotto_36523
Associate III
April 21, 2018
Solved

F091 can bus

  • April 21, 2018
  • 2 replies
  • 928 views
Posted on April 22, 2018 at 01:33

hi!

I'm trying to play a bit with the CAN bus in the NucleoF091RC, I just generate the code with CubeMX with the CAN_Mode set to Loopback (to use only one node and my scope to see the data), dropped that code in Eclipse and tried to debug it. The debug never passes the MX_CAN_Init(); instruction. If I go a bit deep it stays forever on the loop:

/* Wait the acknowledge */

    while(HAL_IS_BIT_SET(hcan->Instance->MSR, CAN_MSR_INAK))

    {

      if((HAL_GetTick()-tickstart) > CAN_TIMEOUT_VALUE)

      {

         hcan->State= HAL_CAN_STATE_TIMEOUT;

       /* Process unlocked */

       __HAL_UNLOCK(hcan);

       return HAL_TIMEOUT;

      }

    }

In the RM is said the normal mode can be activated once the device it synchronized with the bus, but in loopback mode: can I skip the need of the bus?

    This topic has been closed for replies.
    Best answer by T J
    Posted on April 22, 2018 at 02:53

    it stops at Can Init

    I guess 100% you don't have a line driver and therefore, you need a pullup on the Can Rx pin.

    2 replies

    T J
    T JBest answer
    Senior III
    April 22, 2018
    Posted on April 22, 2018 at 02:53

    it stops at Can Init

    I guess 100% you don't have a line driver and therefore, you need a pullup on the Can Rx pin.

    Alejandro Bizzotto_36523
    Associate III
    April 22, 2018
    Posted on April 22, 2018 at 12:26

    and you guess correctly! I understood the opposite and I add a pulldown in both pins

    now I can transmit, Thanks!