893 views|5 replies

6065

Posts

4

Resources
The OP
 

【Jihai APM32F407 Tiny Board】rt-thread stdudio Play with mqtt (10) [Copy link]

 
This post was last edited by damiaa on 2023-6-23 12:58

【Jihai APM32F407 Tiny Board】rt-thread stdudio Play with mqtt (10)

[Jihai APM32F407 Tiny Board] Unboxing Review: Installation Environment and Lighting

[Jihai APM32F407 Tiny Board] Ethernet running example

[Jihai APM32F407 Tiny Board] Run a serial port example USART_Polling

[Jihai APM32F407 Tiny Board] Run a serial port example USART_Interrupt

[Jihai APM32F407 Tiny Board] Play with FreeRTOS

【Jihai APM32F407 Tiny Board】Start rt-thread

[Jihai APM32F407 Tiny Board] Play with FreeRTOS two message queues, keyboard and LED

[Jihai APM32F407 Tiny Board] rt-thread studio uses button and LED driver package

APM32F407 Tiny Board】RT-thread stdudio adc usage (9)

I recently played with the APM32F407 Tiny board and found that rt-thread studio is pretty good. After a few days of exploration, I found that I could play with mqtt .

1. Create a new chip-based project

The serial port uses version V1, otherwise an error will occur

2. Save, build, and download, and a hellworld project will appear.

3. Configure eth

Enable lwip and network interface devices as follows:

Use static IP as follows:

Add the definition BSP_USE_ETH PHY_USING_LAN8720A

to board.h as shown below

Write an empty phy_reset() function, because the reset leg is directly connected to the reset, and the CPU io reset is not used.

Remove main.c LOG_D("Hello RT-Thread!");

4, Save, Build, Download, Test: There is a problem, timeout, the computer can ping it.

Found that the computer firewall was not turned on:

That’s it, the network is connected:

5. Add the mqtt component. Here, select pahomqtt, which is used by many people.

Configure it:

6. Save and build, and find several problems: modify them and let it compile.

7. Build, download, test: it works, MQTT is running.

Here I use my own local mqtt broker. Remember to make sure the IP address is in the same network segment. Ping it before the experiment. Make sure you do not make mistakes with the broker IP address, username, password, and topic.

Thank you for watching.

This post is from Domestic Chip Exchange

Latest reply

This post was last edited by freebsder on 2023-6-24 22:37 Boss, which qos setting is better for client and server?   Details Published on 2023-6-24 22:36
 
 

266

Posts

0

Resources
2
 

回帖奖励 +10 分芯积分

The host is awesome, mqtt is really a good thing

This post is from Domestic Chip Exchange

Comments

Thanks for the encouragement!  Details Published on 2023-6-24 11:45
Personal signature

gitee/casy

 
 
 

6065

Posts

4

Resources
3
 
caizhiwei posted on 2023-6-23 22:40 The OP is awesome, MQTT is indeed a good thing

Thanks for the encouragement!

This post is from Domestic Chip Exchange
 
 
 

7422

Posts

2

Resources
4
 
This post was last edited by freebsder on 2023-6-24 22:37

Boss, which qos setting is better for client and server?

This post is from Domestic Chip Exchange

Comments

It depends on the situation. If you use qos0, it will be faster, but it is not guaranteed to be delivered every time. For example, if you check the temperature, you can check it every few seconds. If it is not delivered, you can check it next time. If it must be delivered every time and there can be no mistakes, use qos1 or qos2. In my experience, qos0 is also more reliable. It is rare that it cannot be delivered (difficult to  Details Published on 2023-6-25 08:47
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

6065

Posts

4

Resources
5
 
This post was last edited by damiaa on 2023-6-25 08:58
freebsder posted on 2023-6-24 22:36 Boss, which qos setting is better for the client and server?

It depends on the situation. If qos0 is used, it will be faster, but it is not guaranteed to be delivered accurately every time. For example, if you check the temperature, it will be done every few seconds. If it is not delivered, you can check it next time.

If it must be delivered every time without error, use qos1 or qos2.

According to my experience, qos0 is also relatively reliable. It is rare that it cannot be delivered (it is rare to encounter).

MQTT defines three QoS levels:

QoS 0, at most once delivery.
QoS 1, at least once delivery.
QoS 2, only once delivery.
Among them, using QoS 0 may lose messages, using QoS 1 can ensure that messages are received, but messages may be duplicated, and using QoS 2 can ensure that messages are neither lost nor duplicated. QoS levels from low to high not only mean the improvement of message reliability, but also the improvement of transmission complexity.

This post is from Domestic Chip Exchange
 
 
 

6065

Posts

4

Resources
6
 
freebsder posted on 2023-6-24 22:36 Big Mi, which qos setting is better for the client and server?

There are some good articles on csdn https://blog.csdn.net/emqx_broker/article/details/128659357

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list