Jump to content
Electronics-Lab.com Community

Use UART to send data--Ameba MicroPython


MENG XI

Recommended Posts

Take a look of UART communication with Ameba RTL8722 which runs MicroPython

Materials

  • Ameba x 1, TTL USB to Serial module x 1

Steps

UART is a very versatile communication protocol and almost an essential part of a microcontroller. A TTL USB to Serial module is an IC that helps to translate UART signal to USB signal so that we can see uart log printed on our PC. This module is often found on many development boards, including ameba. However, the module on Ameba is reserved for LOG UART and Firmware uploading, that is why we need a separate module to communicate between ameba and PC.

There are currently 2 sets of UART available to MicroPython users and they are,

Unit TX RX
0
PA_21
PA_22
3
PA_26
PA_25
Here we are using unit 0 to demonstrate how uart works on ameba.
Connect TTL module to PA_21 and PA_22 as shown below,
get-start-7
Then, copy and paste the following code line by line into REPL to see its effect.
 
from machine import UART
uart = UART(tx="PA_21", rx= "PA_22")
uart.init()
uart.write('hello')
uart.read(5) # read up to 5 bytes
Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
  • Create New...