[Supplement: CAN card communication lower computer - STM32cubeIDE-hal library + STMF1xx + data sending and receiving + interrupt receiving method + basic sample 3]

[Slave computer for CAN card communication - STM32cubeIDE-hal library + STMF4xx + data sending and receiving + interrupt receiving method + basic sample 3]


)

1 Overview

From the first article on F1 and F4, the polling method is used to debug can,
[Subordinate computer of CAN card communication - STM32cubeIDE-hal library + STMF1xx and STMF4xx + data sending and receiving + polling receiving method + basic sample (1)]

Go to the second part of F4 to adopt the interrupt method,
[Slave computer for CAN card communication-STM32cubeIDE-hal library+STMF4xx+data sending and receiving+interrupt receiving method+basic sample (2)]

It has been more than two months since F1 received it in an interrupted manner, and it has not been resolved.
This time, please come to the original boss of ST to help with debugging on the spot.

2. Experimental environment

The experimental environment is actually in two environments, as follows, please choose the corresponding development board according to your own environment.

(1) Software environment: STM32cubeIDE 1.8.0
(2) Hardware chip: STM32F103VET6 (Wildfire: Guide)
(3) Other hardware: j-link or st-link, serial port to usb converter, can card, development board.
(4) Special hardware: STM32F103VET6 (Wildfire: Guider) is a development board without a can conversion chip, so we need to get one ourselves, and STM32F407ZET6 (Punctual Atom: Explorer) is available, and you can use it without an external connection , If you need to buy as follows, you can refer to the can chip SIT1050T of punctual atom F4, or a similar one on Baotao.
insert image description here
The following is one I bought on a certain treasure:
Name: "CAN to TTL module TJA1050T chip solution program source code communication conversion can communication driver module"
insert image description here

The hardware screenshot shown in the figure below

insert image description here

3. Problem description

When I started debugging recently, I configured the can of STM32F1xx according to related articles on the Internet, and after adding relevant codes, I found that it was not running anyway. I couldn't receive anything, and then added serial port printing in the callback function, and found that it died in the can interrupt, as shown in the figure below.

Currently the problem is:In the hal library, under the software STM32cubeIDE, the can of STM32F1 cannot be interrupted, and the data cannot be obtained
insert image description here

4. Big bosses give advice and solve problems

Thousands of books are falsely passed on, but one sentence is true.
As shown in the figure below, because the wording of F4 is imitated, there is an extra "&" symbol, which makes the sample program unable to run successfully.

insert image description here

5. Screenshot of experiment effect

As shown in the figure below, after downloading again, the interruption reception is also successfully realized.
insert image description here

6. Code connection

Code link after F1 succeeds:
https://download.csdn.net/download/qq_22146161/87913290

7. Details

(1) Re-comparing the F4 code, I found that F4 does have this "&" symbol, which is really amazing. This problem is difficult to say, and it is difficult to confirm that it is difficult for ordinary people to predict this.

insert image description here

8. Summary

The last problem is here. I really didn’t expect that I did learn something. Of course, I also need to reflect. A small coincidence caused such a big problem. I still copy the example after learning F4 successfully.

In this way, I think of the thought seal made by a wall-facer in "Three-Body Problem". Among the tens of thousands of codes, a small coincidence can make people's thinking completely produce the opposite effect, from the main battle group to the escape group.

Guess you like

Origin blog.csdn.net/qq_22146161/article/details/131234569