cancel
Showing results for 
Search instead for 
Did you mean: 

CAN3 on NUCLEO-F767ZI is not working for me

B_12159
Associate II
Posted on July 10, 2018 at 18:30

I'm using STM32CubeMX and Keil �Vision V5.25.2.0

to program the NUCLEO-F767ZI board.

MB1137 Rev B

The init sequence is:

static void MX_CAN3_Init(void)

{

  hcan3.Instance = CAN3;

  hcan3.Init.Prescaler = 24;

  hcan3.Init.Mode = CAN_MODE_NORMAL;

  hcan3.Init.SyncJumpWidth = CAN_SJW_1TQ;

  hcan3.Init.TimeSeg1 = CAN_BS1_11TQ;

  hcan3.Init.TimeSeg2 = CAN_BS2_4TQ;

  hcan3.Init.TimeTriggeredMode = DISABLE;

  hcan3.Init.AutoBusOff = DISABLE;

  hcan3.Init.AutoWakeUp = DISABLE;

  hcan3.Init.AutoRetransmission = DISABLE;

  hcan3.Init.ReceiveFifoLocked = DISABLE;

  hcan3.Init.TransmitFifoPriority = DISABLE;

  if (HAL_CAN_Init(&hcan3) != HAL_OK)

  {

    _Error_Handler(__FILE__, __LINE__);

  }

}

Ports are PA8 for RX and PB4 for TX.

The CAN buses on CAN1 and CAN2 are working properly.

Behaviour: the init routine jumps through the error handler.

As result CAN3 is not working.

Any ideas?

#can3-on-nucleo-f767zi
3 REPLIES 3
T J
Lead
Posted on July 11, 2018 at 02:36

enable ABOM,

do you have a transceiver chip ?

if not, then you need a pullup on the CanRx pin

B_12159
Associate II
Posted on July 11, 2018 at 13:45

I am using a pullup on the CanRx pin.

As described: I used the same init for CAN1 and CAN2 and there are no problems.

I traced the MX_CAN3_Init routine and found the source of the error:

  /* Check Sleep mode leave acknowledge */

  while ((hcan->Instance->MSR & CAN_MSR_SLAK) != RESET)

  {

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

    {

      /* Update error code */

      hcan->ErrorCode |= HAL_CAN_ERROR_TIMEOUT;

      /* Change CAN state */

      hcan->State = HAL_CAN_STATE_ERROR;

      return HAL_ERROR;

    }

  }

I traced the code and found, that the routine is always terminated by timeout.

It seems for me, that the CAN controller stays in sleep mode.

Is there a known bug in silicon?

B_12159
Associate II

Now it is fixed:

Using

CAN1 PB8 and PB9

CAN2 PB5 and PB6

CAN3 PA8 and PA15

Important:

Bridges on the backside have to be soldered as follows:

SB115: close

SB169: open

factory default is: SB115 open, SB169 close

so you have to solder the 0-ohm-resistor to SB115 position