AnsweredAssumed Answered

Should the GPIO pins toggle when transmitting CAN1 (STM32F4discovery)

Question asked by Aart Scheepers on Nov 15, 2017
Latest reply on Nov 19, 2017 by Aart Scheepers

I am trying to make the can interface work on the STM32F4Discovery board.

I did create a project with Cube, and noted CAN1 as being on PD0 and 1.

Then I created a can message and am trying to send it through CAN1 with HAL_CAN_Transmit...

My circuit, only the pins PD0 and 1 are pulled up to 3V, rest is left alone , as I want to see something happen on those pins.


I see in the debugger that:

1) When pulling down PD0 or PD1, CAN does not initialize - It fails with timeout in the initialization of the hardware

2) When pulling up PD0 and PD1, CAN does initialize

3) When doing the HAL_CAN_Transmit, it fails with a timeout.


If I connect a oscilloscope on the PD0 and 1, they are both high and do not toggle; nothing happens.

Question: Without anything connected to the pins except a pullup (2k resistor) should I expect something to happen?


This is my code for trying to send messages:


CanTxMsgTypeDef mes;
    mes.DLC = 8; //Length of data
    mes.Data[0] = 0;
    mes.ExtId = 1;
    mes.IDE = CAN_ID_STD;
    mes.RTR = CAN_RTR_DATA;
    mes.StdId = 1;
    hcan1.pTxMsg = &mes;
    /* Infinite loop */
    while (1) {
        /* USER CODE END WHILE */
        HAL_CAN_Transmit(&hcan1, 100);
        /* USER CODE BEGIN 3 */



I added a zip file with the src and inc folder of my project...

What is the best way to proceed here? Do I need some more circuitry, to get things going?


Thanks for pointing me into the right direction.