Uncategorized

uart notes

Asked 
Viewed 8 times
0

I have a project to make mobile robot with Dynamixel AX-12A as the wheel, so i changes the AX-12A to Wheel Mode with CM-530 and it works well.

I follow the guide from http://www.oppedijk.com/robotics/control-dynamixel-with-raspberrypi

I already check my serial communication (UART) on Raspi using Terminal Minicom with only wiring up GPIO14 and GPIO15 together and it works well

Here is my /boot/config.txt at the end of code:

dtoverlay=pi3-disable-bt
hdmi_force_hotplug=1
enable_uart=1
init_uart_clock=16000000

Here is my /boot/cmdline.txt:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-serial-consoles

Here is my Python3 Code:

import serial
import time
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.setwarnings(False)

port = serial.Serial("/dev/ttyAMA0", baudrate=1000000, timeout=3.0)

while True:
    GPIO.output(18, GPIO.HIGH)
    port.write(bytearray.fromhex("FF FF 00 04 03 20 FF D8"))
    time.sleep(0.1)
    GPIO.output(18, GPIO.LOW)
    time.sleep(3)

The problem is dynamixel ax-12a not responding to my hexa which should move with value 255. And there is no error feedback from program.

Btw i’m working this project with VNC through wifi in PC, did this cause problems with the communication?

If someone could help me, i thank you.

*sorry if i have bad english

 New contributor
  • Hi @Ryan Fikri, Welcome and nice to meet you. (1) Your use of English is better than mine. Your question is clear and gives all the necessary info and references. Your procedure is described detailed enough for me to follow, and convinced that I am following your direction. (2) Rpi miniCom is not a good choice. I would suggest to use Rpi CuteCom (need to install yourself), or Win10 RealTerm (google SparkFun for more details) (3) Not sure what does the clock 16MHz mean. I would suggest to make sure, or set to 9600 baud, N81, and set the same for Rpi TxD, RxD, / to continue, … – tlfong01 36 mins ago   
  • (4) I have been playing with more than 20+ UART interfaced devices for more than 10 hobbyist years. I do use Arduino C++ and Rpi python, BUT I NEVER START with poython. I always suggest newbies to start with the following: (a) Use the terminal emulator RealTerm, CuteTerm (or TeraTerm, or if you insist, miniTerm, miniCom) to do “loop back” test, to make sure the hardware wiring is OK, (5) please reply if you are reading my comments, before I move on, … – tlfong01 32 mins ago   
  • If you are not too sure what I am talking about, you might like to skim the following Q&A, especially the CHAT record, to get a rough idea: raspberrypi.stackexchange.com/questions/105223/…. Nice UART learning and cheers. – tlfong01 30 mins ago    
  • One more thing: Your config procedure seems a bit out of date. There is no need to mess around the newbie scary /boot/cmdline.txt file. Instead, use the newbie friendly Rpi GUI desktop Rpi Config menu to do the job: imgur.com/gallery/wNGTxyy. – tlfong01 49 secs ago   Edit   Delete

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: