当前位置:网站首页>K210 learning notes (II) serial communication between k210 and stm32
K210 learning notes (II) serial communication between k210 and stm32
2022-04-23 08:40:00 【PI Zhi of Engineering^_^】
List of articles

Preface
Want to use STM32 Give to through a serial port K210 Sending data , And show on the screen , Read several blogs , It's finally worked out , You can have a look if you are interested .
K210 Learning notes ( One ) K210 And STM32 Serial communication related
connection ,STM32 The serial port pin of is relatively fixed , and K210 It's like a cow , Arbitrary mapping , Good news for the lazy . Here I found two that have not been reused IO,IO9 and IO10
| STM32 | K210 |
|---|---|
| GND | GND |
| PA10(RXD) | IO10(TXD) |
| PA9(TXD) | IO9(RXD) |
One 、STM32 End
I use punctual atoms STM32F103ZET6 Elite board
This serial port routine needless to say , Almost all routines are self-contained serial ports 1, Don't talk much , After the main function is initialized, it can be used directly printf Print
printf("%.2f",temp_wendu);// Print

Two 、K210
k210 The end is simpler , Than 32 It's simple . It's using microPython, Grammar is Python.
After introducing the corresponding module , To initialize . One of the most important is codec ,32 The serial port over there sends byte data , In order to UTF-8 Coded , therefore K210 The end needs to be UTF-8 Decoding can display normally .
import sensor
import image
import lcd
import time
import utime
from machine import UART
from fpioa_manager import fm
fm.register(10, fm.fpioa.UART1_TX, force=True)# Mapping serial port pin
fm.register(9, fm.fpioa.UART1_RX, force=True)# Mapping serial port pin
uart = UART(UART.UART1, 115200, 8, 1, 0, timeout=1000, read_buf_len=4096)
clock = time.clock()
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
sensor.skip_frames(30)# Skip just started 30 Frame photo
lcd.rotation(2)#LCD Screen flip , The scope is 0~3
sensor.set_hmirror(True)# Camera image
while True:
img = sensor.snapshot()# Get a picture from the camera
read_data = uart.read(5)# Read serial data , Read 5 Bytes
read_data=read_data.decode('utf-8')# Conduct utf-8 decode
if uart.read()!=None:
img.draw_string(2,2, ("temp=%s" %(read_data)), color=(0, 176, 80), scale=2)
lcd.display(img)
test result
Now we can see , Successfully received serial port data , And in LCD Displayed on the . from K210 Send out STM32 It's the same . Add one \r\n That's it . Next time we can talk about .

版权声明
本文为[PI Zhi of Engineering^_^]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230759143617.html
边栏推荐
- 洋桃電子STM32物聯網入門30步筆記一、HAL庫和標准庫的區別
- Ear acupoint diagnosis and treatment essay 0421
- RPC procedure
- Asan minimalism
- Add listening event to input element
- 什么是RPC
- idea配置连接远程数据库MySQL,或者是Navicat连接远程数据库失败问题(已解决)
- 信息收集相关知识点及题解
- uni-app和微信小程序中的getCurrentPages()
- [explanation] get ora-12838: cannot read / modify an object after modifying it in parallel
猜你喜欢

数据可视化:使用Excel制作雷达图

Overview of bus structure

Use of Arthas in JVM tools

经典题目刷一刷

xctf刷题小记

bashdb下载安装

RCC introduction of Hal Library

Get the absolute path of the class according to the bytecode

Input / output system
![Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]](/img/67/1f9df4236b0aac3480836d45ab8561.png)
Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]
随机推荐
Ajax cache prevention method
STM32 uses Hal library. The overall structure and function principle are introduced
QT compilation qtxlsx Library
经典题目刷一刷
Navicat remote connection MySQL
JSP page coding
Excle plus watermark
Go语言自学系列 | golang结构体的初始化
Use of applicationreadyevent
《深度学习》学习笔记(八)
队列(c语言/链表)
Type anonyme (Principes fondamentaux du Guide c)
Star Trek强势来袭 开启元宇宙虚拟与现实的梦幻联动
Reference passing 1
Anonymous type (c Guide Basics)
Yangtao electronic STM32 Internet of things entry 30 step notes IV. engineering compilation and download
2022-04-22 OpenEBS云原生存储
洋桃电子STM32物联网入门30步笔记四、工程编译和下载
bashdb下载安装
Asan minimalism