1189 views|1 replies

282

Posts

2

Resources
The OP
 

【Smart network desk lamp】9. Maix bit driver serial port [Copy link]

 

Past Sharing

[2022 Digi-Key Innovation Design Competition] Latest unboxing post
[2022 Digi-Key Innovation Design Competition] 1. ESP32-S2 environment construction and lighting
[Smart Network Desk Lamp] 2. Setting system time and printing
[Smart Network Desk Lamp] 3. ESP32-S2 + lvgl use
[Smart Network Desk Lamp] 4. ESP32-S2 onboard button use
[Smart Network Desk Lamp] 5. ESP32-S2 uses sntp for network time synchronization
[Smart Network Desk Lamp] 6. ESP32-S2 solves the problem of excessive RAM space overhead

【Smart Network Desk Lamp】7. Get real-time weather information and analyze it

【Smart network desk lamp】8. Maix bit driver RGB

Preface

The early software development was done on ESP32S2. We planned to use Maix bit for video recording and fiber strength detection, so it would involve communication between ESP32S2 and Maix bit. Using uart for communication is relatively simple and fast, and it uses very few resources.

This post describes how to drive the serial port on the maix bit, which is very simple to implement.

introduce

For the use of the serial port, please refer to the official documentation: https://wiki.sipeed.com/soft/maixpy/zh/api_reference/machine/uart.html#read

The good thing about the maix bit is that any pin can be mapped to be used as a peripheral, which is very convenient.

Hardware Hookup

io9--RX

IO10 -- TX

In the development stage, use the USB-TTL tool to connect IO9 and IO10. The connection relationship is as follows:

USB-TTL Maix Bit

RX IO10

TX IO9

Software Implementation

Software development uses Python. You need to map the IO port first, then initialize the serial port baud rate to 115200, 8 bits, no stop bit and parity bit. Finally, print the hello world string in a loop, once a second.

from machine import UART
from board import board_info
from fpioa_manager import fm
import utime

# 初始化串口,PIN10为TX,PIN9为RX
fm.register(board_info.PIN10, fm.fpioa.UART1_TX, force=True)
fm.register(board_info.PIN9, fm.fpioa.UART1_RX, force=True)

# 设置串口参数,波特率为115200
uart_A = UART(UART.UART1, 115200, 8, 0, 0, timeout=1000, read_buf_len=4096)

write_str = 'hello world\r\n'
while(True):
    uart_A.write(write_str)
    print("string = ", write_str)
    utime.sleep_ms(1000)

Achieve results

Use maixpyide to send the code to maix bit for debugging. The effect is as follows:

This post is from DigiKey Technology Zone

Latest reply

Maix bit drives the serial port. According to the original poster's method, it is really simple to drive the serial port on maix bit.   Details Published on 2022-10-14 07:51
 
 

6609

Posts

0

Resources
2
 

Maix bit drives the serial port. According to the original poster's method, it is really simple to drive the serial port on maix bit.

This post is from DigiKey Technology Zone
 
 
 

Guess Your Favourite
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