cancel
Showing results for 
Search instead for 
Did you mean: 

CAN TX and Rx-STM32F769i

Rizwan Syed
Associate II
Posted on April 10, 2017 at 16:02

Hi,

I am testing CAN interface on STM32F769i-Eval board.

Checked the default CAN_Loopback loopback example from the following path

STM32Cube_FW_F7_V1.6.0\Projects\STM32F769I_EVAL\Examples\CAN\CAN_Loopback

Data is transmitting and receiving properly when confirmed through LED.

Other than LED confirmation,I tried to capture the CAN packets from the connector CN26.

But I am not able to find CAN packets coming out from the CN26 connector.

Also,Checked the default CAN_Networking example from the following path

STM32Cube_FW_F7_V1.6.0\Projects\STM32F769I_EVAL\Examples\CAN\CAN_Networking

i feel like the frame may not be getting transmitted.

Am using kvaser tool and application for seeing messages on PC and i could see errorframe messages.

I am able to see the CAN packets with other device using the kvaser tool and application.So I believe Kvaser Tool and PC application is working fine in my test environment.

Is there any additional configuration is required in evk to get the CAN packets in CN26 connector?

Test Environment:

EVK(CN26)------->Kvaser Tool-------->PC(CAN packet Sniffing Application)

Thanks and Regards

Rizwan Syed
7 REPLIES 7
Max
ST Employee
Posted on April 11, 2017 at 06:15

Hello,

The EVAL board is so crowded that there is no unused GPIO pin available for the can interface, so none has been configured in the loopback example.

You must configure one of the CAN_TX pin as alternate function to see its signal.

Be aware that whichever pin you choose, it is physically connected to something else, and this may impact your test.

You may have to disconnect one pin from its original function.

CubeMx may help you select the best pin for your test.

I recommend to open CubeMx > New Project > Board selector > your eval board

unfold your CAN interface and hover the red configuration with your mouse. You will see what is conflicting with the mode you want to use. 

Or even better, you could try it on the nucleo-F767zi or the STM32F769I-DISCOVERY, if you own one, they have CAN pin available.

Rizwan Syed
Associate II
Posted on April 11, 2017 at 10:30

Hi Max,

Thanks for your reply.

 PA12 is configured as  CAN_TX and PA11 is configured as CAN_RX.

We verified in schematics of evaluation baord, PA12 and PA11 are connected CAN_TX and CAN_RX respectively to CN26 connector.

In stmf7xx_hal_msp.c file , the following code is configured 

/* CAN1 TX GPIO pin configuration */

GPIO_InitStruct.Pin = CANx_TX_PIN;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Speed = GPIO_SPEED_FAST;

GPIO_InitStruct.Pull = GPIO_PULLUP;

GPIO_InitStruct.Alternate = CANx_TX_AF;

HAL_GPIO_Init(CANx_TX_GPIO_PORT, &GPIO_InitStruct);

/* CAN1 RX GPIO pin configuration */

GPIO_InitStruct.Pin = CANx_RX_PIN;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Speed = GPIO_SPEED_FAST;

GPIO_InitStruct.Pull = GPIO_PULLUP;

GPIO_InitStruct.Alternate = CANx_RX_AF;

HAL_GPIO_Init(CANx_TX_GPIO_PORT, &GPIO_InitStruct);

Thanks and Regards

Rizwan Syed

Jith cr
Associate II
Posted on April 11, 2017 at 10:36

Hi Max,

I got a confusion here.

Is there any concern to use STM32F769I evaluation board to do the CAN test?

I feel CAN1 signals are coming out through CN26 connector in evaluation board.

Please correct me if I am wrong.

Posted on April 11, 2017 at 12:00

No there is no problem.

Just make sure JP14 is fitted and you are not using the USB_FS interface at the same time.

They are sharing the same pins

Rizwan Syed
Associate II
Posted on April 17, 2017 at 11:24

Hi Max,

I am testing CAN interface on STM32F769i-Eval board.

I have created a CAN Application and i can able to receive CANpackets on the PC Application in Loopback mode.

Moreover in Loopback mode, I am unable to receive CANpackets from PC to board.

Unable to receive messages in Normal mode.How can i make transmit and receive working with Normal Mode.

Am using kvaser tool and application for seeing messages on PC.

Thanks and Regards

Rizwan Syed

Posted on April 17, 2017 at 11:46

How is JP14 on your board?

Rizwan Syed
Associate II
Posted on April 18, 2017 at 12:01

Hi Max,

Thanks for your reply.

Now Transmit and receive is working but when i transmit the data from PC to board only that moment, board receives the data and again board transmits the data to PC.

Otherwise data transfer does not happen.I need continuous transfer of data, so m,y code is in while(1) loop.

My understanding is, Timeout is not happening in HAL_CAN_Receive() function.

 Please suggest how to proceed

Thanks and Regards

Rizwan Syed