cancel
Showing results for 
Search instead for 
Did you mean: 

CAN BUS, cube not receiving message

laggersvk
Associate II
Posted on February 07, 2015 at 13:10

Hello, I have been using standard libraries but when CUBE got released I switched. I cant receive any CAN messages with CUBE.

-I am using f072

-Configured clocks, baud rate, filters(default)

-Using interrupt

-Silent loopback mode

-Hcan structure is filled correctly.

-I havent found any pin configuration in cube generated code

I can see TX data flow on oscilloscope with loopback mode. But It never generates the HAL_CAN_Rx_CpltCallback event when using HAL_CAN_Receive_IT. When debugging I also tried to put break point into CAN interrupt handler itself but it stops in timer interrupt handler bellow. Its interesting that program stops in different location from where breakpoint is.

I couldnt understand and find on community where the problem might be. I saw that few people had similar problems.

#f0 #bus #receive #can #cube
8 REPLIES 8
laggersvk
Associate II
Posted on February 15, 2015 at 17:03

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6gw&d=%2Fa%2F0X0000000btL%2F.etjmOsZ.8au4kvb32g3SBAb7h2hq0VvpCB8J7xu3gU&asPdf=false
Amel NASRI
ST Employee
Posted on February 16, 2015 at 11:36

Hello Marek,

Please have a look to the CAN example available in ''STM32Cube_FW_F0_V1.0.0\Projects\STM32072B_EVAL\Examples\CAN\CAN_Networking'', compare this example with your generated project & check updates you made.

This way, you may understand clearly what is going wrong in your case.

The package is available in http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF260612.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

laggersvk
Associate II
Posted on February 24, 2015 at 23:44

Hello Mayla,

Thank You for reply. Its starting to get strange. I tried to generate the code for f429 and using the same code for CAN and incredibly it works. I get RX interrupts there. But f072 code doesnt work and its the same.

I have looked at example. It looks like it isnt generated with cubemx and didnt found any difference between mine.

What I dont understand:

-program breaks at location where isnt breakpoint

-master CAN vs slave CAN cube configuration. Whats the difference and why only master option in f072.

-F072 has only CEC/CAN interrupt f429 has also CAN TX, CAN RX interrupts options. Why?

Marek
Posted on February 25, 2015 at 02:10

Are you sure about the Filter# ?

If this is a CAN1 master, then 14 would be invalid, does it work with 0 or 1?

The STM32F072 only has ONE CAN interface

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
laggersvk
Associate II
Posted on February 25, 2015 at 14:29

Filter 0 or 1 doesnt solve the issue.

As F429 is working there must be some difference between these two MCUs that I dont know.

Marek.
Posted on February 25, 2015 at 15:22

The F0 is a significantly simplified device, the CAN peripheral only supports one interface.

If you're sure it's not the software, you could review the hardware, or frankly try an SPL implementation to confirm it's not a Cube/HAL issue.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
laggersvk
Associate II
Posted on March 05, 2015 at 21:30

Hello, 

Its solved!

There were two problems

 

-Filter number should be as clive said. Iam using 0

-There is an incompatibility in CUBE generated code with emblocks generated startup_....S file. The interrupt vector for CAN is different from the name of the interrupt CAN routine generated by cube.

Took really long to find out.

Using

 

-emblocks v2.3

-Cubemx v1.0

-Hal f0 v1.3

Thanks for your help.

Marek

yan
Associate
Posted on July 24, 2015 at 11:45

Hello,

I had the same issue and your last answer gave me the solution 🙂

HAL_CAN_Receive work well (good way to test filters) but HAL_CAN_Receive_IT dont (never go to HAL_CAN_RxCpltCallback function).

There is different names on IT declarations code generated by CubeMX (CAN_RX1_IRQ... and CAN_RX0_IRQ...). Changing aliases in ''stm32f...xe.h'' work for my.

I hope it will be fixed in a following version.

Using :

- Keil uVision v5.15

- STM32CubeMX v1.0 (4.9.0)

- HAL f3 v1.1.1

Thank you!