[Joint debugging of QT self-developed upper computer and STM32F4xx lower computer>>>can communication test-basic sample-joint article]

1 Overview

I used to make qt host computer software, and now I have qt lower computer software, which uses STM32. With these two items, we have enough steps to do a joint article, which can be jointly debugged, and in The lower computer for writing can is that the idea of ​​this joint article was born at that time.

2. Experimental environment

The experimental environment is still very important, because sometimes, things that can run on your computer may not run on other people's computers. This part of the reason may be that the experimental version is different.
QT software version: qt 5.14.2
insert image description here

The hardware is actually connected to the lower computer, so F1 and F4 don't matter.

(1) Software environment: STM32cubeIDE 1.8.0
(2) Hardware chip: STM32F103VET6 (Wildfire: Guider)
(3) Hardware chip: STM32F407ZET6 (Punctual Atom: Explorer)
Other hardware accessories: j-link,can card, PC, serial port converter.
Description: The upper and lower computer link bridge, relying oncan card.
As shown in the figure below, this time the hardware.
insert image description here

3. Joint articles

(1) For the upper computer, you can refer to the following example

For the sample article, you can refer to any one:
[QT5: Host computer for CAN card communication - code exercise - send and receive data + layout + reference external library + basic sample (1)]

[QT5: Host computer for CAN card communication - add oscilloscope - interface optimization and modification + analysis function writing + advanced samples (2)]

(2) For the lower computer, you can refer to the following example

Sample articles:
one is to send and receive articles cyclically.
[Slave computer for CAN card communication - STM32cubeIDE-hal library + STMF1xx and STMF4xx + data sending and receiving + polling receiving method + basic sample (1)]

One is to interrupt F4 to send and receive articles.
[Slave computer for CAN card communication - STM32cubeIDE-hal library + STMF4xx + data sending and receiving + interrupt receiving method + basic sample (2)]

4. QT upper computer part

Although we did a QT-related experiment before, no matter whether we get someone else's code or our own code, we'd better verify it to ensure that there is no problem with the code itself. In the end, I didn't notice a point of my own, and I lost myself.

Step 1: Download and compile the QT code.

After downloading the code, run it directly.
As shown below
insert image description here

The second step: QT code verification.

After inserting the can card usb, select the self-sending and self-receiving mode.
insert image description here

Click the software to send the message automatically.
insert image description here

Thus, the QT software part is verified.

5. STM32 lower computer part

Although we did a STM32-related experiment before, whether we get someone else's code or our own code, we'd better verify it to ensure that there is no problem with the code itself. In the end, I didn't notice a point of my own, and I lost myself.

The first step: STM32 code verification.

Here we use the STM32F4 code as an example, download the code, and click compile.
insert image description here
It can be seen that an error was reported, and an extra letter was typed, so after removing it, it is ok.
insert image description here

Step 2: Change the downloader and serial port converter.

(1) The j-link I used this time does not use ST-link, so it needs to be set.
insert image description here
(2) Depending on the converter model, the connection method may be different, but the connection to the STM32 pins is as follows.

PA11 --- can_rx---  
PA12 --- can_tx--- 
PA9 --- USART1_TX---
PA10 --- USART1_RX--- //可以不接
GND  --- GND ----//共地细节 别忘了

After downloading, use the can software - verify the result

Using the software of the can cassette, you can see that the message is received, and the serial port also prints the message after sending it out.
insert image description here

6. Joint debugging

After completing the above tests, you can start joint debugging. In fact, the entire hardware channel has been set up. When testing the STM32 code, it is over. You only need to close the "can software" and run the QT program. As shown below.
insert image description here

Details

(1) After the uploaded F4 code is compiled, an error will be reported.

This block did accidentally type an extra letter, which has been corrected. If the error still occurs, then type and change it by yourself.
insert image description here

Summarize

It feels the simplest, but also needs to be debugged step by step.
Since then, can related can also come to an end.

Guess you like

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