cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 CAN with STM32Cube HAL

serkodog
Associate II
Posted on February 02, 2015 at 13:35

Help me, please.

I've got STM32F042K6T6.

I generated project for IAR with STM32Cube. I need use CAN-BUS in my device but i can't, cause it doesn't work.

I have CAN transmission in Infinite loop with 100ms delay. First 3 transmissions return timeout error ( /* Check End of transmission flag */ while(!(__HAL_CAN_TRANSMIT_STATUS(hcan, transmitmailbox)))). And then i haven't anymore mailboxes and HAL_CAN_Transmit returns HAL_CAN_STATE_ERROR. I have tested all CAN modes: CAN_MODE_NORMAL, CAN_MODE_LOOPBACK etc. I have got CAN driver SN65HVD233DR.

I attach a main.c file to the message.

And i see nothing on CAN_TX pin with oscilloscope - only 3.2 Volt.

What i'm doing wrong? Help me please!

Thanks!

#can #hal #bxcan #stm32f0 #bus
15 REPLIES 15
serkodog
Associate II
rm239955
Associate II
Posted on February 03, 2015 at 14:22

Have you enabled your CAN_RX Interrupt function?

If not enable the inteerupt function

serkodog
Associate II
serkodog
Associate II
Posted on February 04, 2015 at 09:49

Resolved.

You was right. When I initialized and activated filter all became OK.

I

nterrupt

work now and I see received data!

THANKS!

rm239955
Associate II
Posted on February 04, 2015 at 11:01

Can you send me the program