WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Enable UART serial communications while mainainting wifi  (Read 181 times)

Offline eSPee

  • Newbie
  • *
  • Posts: 18
Enable UART serial communications while mainainting wifi
« on: September 20, 2024, 07:54:00 AM »
Hi all,

Can anybody help?
I found a great (silent) stepper motor driver:
TMC2209 V4.0 https://wiki.fysetc.com/Silent2209/#wiring-diagram and i would love to use this python library to run it:
https://github.com/Chr157i4n/TMC2209_Raspberry_Pi especially for enabling the stallguard functionality.

The library requires the serial port to be enabled for UART communication. However i am finding this difficult to get working on the piCore 14.1 & Raspberry Pi Zero w.
In this thread enabling the serial functionality is explained: https://forum.tinycorelinux.net/index.php/topic,24825.0.html

Steps taken so far:
1. In /opt/bootlocal.sh uncommened the line that starts serial console
2. In cmdline.txt changed console to: console=serial0,115200
3. In config.txt added this at the end:

Code: [Select]
[PI0]                                                                         
dtoverlay=disable-bt

When i get at step 3 the Pi losses wifi and i can't connect to it anymore. (It runs headless on wifi)  When step3 is omitted i test the serial functionality with minicom:

Code: [Select]
sudo tce-load -wi minicom
minicom -D /dev/serial0 -b 115200

Which gives me an error:

Code: [Select]
minicom: cannot open /dev/serial0: No such file or directory
Adding
Code: [Select]
enable_uart=1 to config.txt doesn't seem to help either.

Can anybody point me in the right direction to get serial over UART working while mainainting wifi functionality on the raspberry pi zero w?
Many thnx!

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1223
Re: Enable UART serial communications while mainainting wifi
« Reply #1 on: September 20, 2024, 08:02:09 AM »
If you want to use the serial port for your program, you need to disable the serial console.

Offline eSPee

  • Newbie
  • *
  • Posts: 18
Re: Enable UART serial communications while mainainting wifi
« Reply #2 on: September 28, 2024, 08:58:06 AM »
Thnx Paul! ;)

The UART is now working. What i did:

1. Added this to config.txt:
Code: [Select]
enable_uart=1
2. Changed the console entry in cmdline.txt to (not sure if this is actual required):
Code: [Select]
serial0,115200
No other changes were made. I tested the UART communications with a USB to TTL adapter (FTD1232).
I can connect by SSH through Wifi and from there send commands to the UART serial port:
Code: [Select]
echo "Hello!" > /dev/ttyS0

Which shows up in the serial port console.

Unfortunately, it is not possible to send commands from the serial port console to the raspberry.

Does anybody know if / how this can be enabled?
« Last Edit: September 28, 2024, 09:03:00 AM by eSPee »

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1223
Re: Enable UART serial communications while mainainting wifi
« Reply #3 on: September 28, 2024, 09:41:39 AM »
From cmdline, it is only a readonly console.   You need to attach getty to the serial port to be able use it.

I think there is a script called startserialconsole to facilitate this.  But it may need tweaked for your port

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1223
Re: Enable UART serial communications while mainainting wifi
« Reply #4 on: September 28, 2024, 11:48:03 AM »
Just looked at the startserialtty script.  It was never updated for the pi4/cm4/pi5   but it should work for the zero

Make sure you have read through this https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1223
Re: Enable UART serial communications while mainainting wifi
« Reply #5 on: September 28, 2024, 11:53:11 AM »
Just looked at the startserialtty script.  It was never updated for the zero/pi4/cm4/pi5

should be able to just use.
Code: [Select]
/sbin/getty -L serial0 115200 vt100 &

Make sure you have read through this https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts

you may need to reference ttyS0 instead of serial0.
« Last Edit: September 28, 2024, 11:57:31 AM by Paul_123 »