cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0B1CBT6 System Bootloader: CANFd. No Response

TSola.1
Associate II

Greetings!

I was trying to make a host device on STM32G0 to access system Bootloader of another STM32G0B1CBT6 to update Firmware over CANFd. Reference was taken from "AN5405"

I configured the host device as mentioned in Application note and tried to the "GET Command" on CAN ID from 0x00 to 0x7ff, but i didn't received any response from system bootloder. Configuration of host is as below:

Clock Frequency: 20Mhz

 hfdcan1.Instance = FDCAN1;

 hfdcan1.Init.ClockDivider = FDCAN_CLOCK_DIV1;

 hfdcan1.Init.FrameFormat = FDCAN_FRAME_FD_BRS;

 hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;

 hfdcan1.Init.AutoRetransmission = ENABLE;

 hfdcan1.Init.TransmitPause = DISABLE;

 hfdcan1.Init.ProtocolException = DISABLE;

 hfdcan1.Init.NominalPrescaler = 1;

 hfdcan1.Init.NominalSyncJumpWidth = 16;

 hfdcan1.Init.NominalTimeSeg1 = 63;

 hfdcan1.Init.NominalTimeSeg2 = 16;

 hfdcan1.Init.DataPrescaler = 1;

 hfdcan1.Init.DataSyncJumpWidth = 4;

 hfdcan1.Init.DataTimeSeg1 = 15;

 hfdcan1.Init.DataTimeSeg2 = 4;

 hfdcan1.Init.StdFiltersNbr = 1;

 hfdcan1.Init.ExtFiltersNbr = 0;

 hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;

 if (HAL_FDCAN_Init(&hfdcan1) != HAL_OK)

 {

  Error_Handler();

 }

FilterConfig.IdType = FDCAN_STANDARD_ID;

FilterConfig.FilterIndex = 0;

FilterConfig.FilterType = FDCAN_FILTER_RANGE;

FilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;

FilterConfig.FilterID1 = 0;

FilterConfig.FilterID2 = 0x7ff;

if (HAL_FDCAN_ConfigFilter(&hfdcan1, &FilterConfig) != HAL_OK)

{

CAN_FD_ErrorCode = CAN_FD_ConfigFiltterError;

CAN_FaultStatus = true;

globalErrorStatus = true;

Error_Handler();

}

/* Configure global filter:

Filter all remote frames with STD and EXT ID

Reject non matching frames with STD ID and EXT ID */

if (HAL_FDCAN_ConfigGlobalFilter(&hfdcan1, FDCAN_FILTER_TO_RXFIFO0, FDCAN_FILTER_TO_RXFIFO0, FDCAN_FILTER_REMOTE, FDCAN_FILTER_REMOTE) != HAL_OK)

{

CAN_FD_ErrorCode = CAN_FD_GlobalFillterError;

CAN_FaultStatus = true;

globalErrorStatus = true;

Error_Handler();

}

/* Activate Rx FIFO 0 new message notification */

if (HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0) != HAL_OK)

{

CAN_FD_ErrorCode = CAN_FD_RxFifoActivationError;

CAN_FaultStatus = true;

globalErrorStatus = true;

Error_Handler();

}

/* Prepare Tx message Header */

txHeader.Identifier = 0x1;

txHeader.IdType = FDCAN_STANDARD_ID;

txHeader.TxFrameType = FDCAN_DATA_FRAME;

txHeader.DataLength = FDCAN_DLC_BYTES_64;

txHeader.ErrorStateIndicator = FDCAN_ESI_ACTIVE;

txHeader.BitRateSwitch = FDCAN_BRS_ON;

txHeader.FDFormat = FDCAN_FD_CAN;

txHeader.TxEventFifoControl = FDCAN_NO_TX_EVENTS;

txHeader.MessageMarker = 0;

/* Configure and enable Tx Delay Compensation, required for BRS mode.

TdcOffset default recommended value: DataTimeSeg1 * DataPrescaler

TdcFilter default recommended value: 0 */

if (HAL_FDCAN_ConfigTxDelayCompensation(&hfdcan1, 5, 0) != HAL_OK)

{

CAN_FD_ErrorCode = CAN_FD_ConfigTxDelayError;

CAN_FaultStatus = true;

globalErrorStatus = true;

Error_Handler();

}

if (HAL_FDCAN_EnableTxDelayCompensation(&hfdcan1) != HAL_OK)

{

CAN_FD_ErrorCode = CAN_FD_EnableTxDelayError;

CAN_FaultStatus = true;

globalErrorStatus = true;

Error_Handler();

}

/* Start the FDCAN module */

if (HAL_FDCAN_Start(&hfdcan1) != HAL_OK)

{

CAN_FD_ErrorCode = CAN_FD_StartError;

CAN_FaultStatus = true;

globalErrorStatus = true;

Error_Handler();

}

During transmission of CAN packet i used to change Tx Identifier from range of 0x00 to 0x7ff.

Also Data Length was tried both 0 and 1 as mentioned in Application note.

Any help would be appriciated.

Thanks,

Tirthraj Solanki

3 REPLIES 3
MM..1
Chief III

Primary you check if client is in bootloader mode.

Secondary your connection need on client be as AN2606 only pin PD0 PD1

Hi,

Thank you for your response.

So, yes client is in bootloader mode, verified by using UART protocol.

Also pin used for CANFd are PD0 and PD1.

Ok then bootloader maybe detect some other interface or you have mistake , protocol speed 0.5M?