0

Firstly, I'm floundering and out of my depth, like a blind man in a dark room looking for a black cat that really isn't there. I've been going around in circles all day with this and have had to admit defeat after multiple failed solutions (aka guesses). Please try and keep help, if you'd be so kind, to be reasonably basic.

Situation: I'm running a 3D printer from an RPi 4b. All had been running perfectly for a year or so until today, when I changed an unrelated bit of printer hardwire. Somehow during this I have stuffed up GPIO14 and 15, which I was using to communicate with the printer (using Klipper/Mainsail). I found the stuff up using gpiotext. That shows me that everything works ... other than GPIO 14 & 15.

(Edit as I forgot to state): I'm now trying to use a different pair of pins for comms. I've picked GPIO8 & 9, but it needn't be that pair if there's a reason they can't be used.

What I had originally...

In my RPi /boot/config.txt I HAD the following:

   enable_uart=1
   dtoverlay=disable-bt

I've tried multiple things in the new config.txt and I think the closest I have got might be this:

   enable_uart=1
   dtoverlay=uart1
   dtoverlay=pi3-miniuart-bt
   dtoverlay=uart1,txd1_pin=8,rxd1_pin=9
   dtoverlay=disable-bt

What I think I'm doing there, line by line ...

   Enabling UART in general terms
   Setting things to use UART1
   A line that, well, just seems to need to be there but might not
   Setting the pins to be GPIO8 (TX) and GPIO9 (RX)
   Disabling Bluetooth, as that was there already

Additionally, in my printer.cfg, in Klipper/Mainsail, I have changed a line. Originally I had:

  [mcu]
  serial: /dev/ttyAMA0
  baud: 250000
  restart_method: command 

And "/dev/ttyAMA0" now reads "/dev/ttyAMA1"

I think I need to use UART 1, and I think I can use any free GPIO pins. However, I'm finding all sorts of different advice on the net, none of which are quite my situation. The only relevant hardware change I've made is to move the TX and RX cables to those new pins.

I know this can be done, and don't want to have to cheat and buy a new RPi so I have working GPIO 14 and 15, but I've tried just about everything and can't get this going.

I'm missing something, hopefully a simple something, but just can't get it.

Help please, and let me know if there's info you need I haven't supplied. I am really floundering here.

Natator
  • 3
  • 2

1 Answers1

0

Updated answer due to changes in Question.

The Pi4 has additional UART Raspberry Pi4 UART

If you want to use GPIO8/9 (which are normally used for SPI0) you should use dtoverlay=uart4

The additional UART will appear as /dev/ttyAMAn - most likely ttyAMA1 but this is expected to change to a predictable identifier with the next kernel update which I believe will allocate ttyAMA4.


The ONLY thing you have to do is put enable_uart=1 in /boot/config.txt OR better still run sudo raspi-config Select Interfacing Options / Serial then specify if you want a Serial console (probably no) then if you want the Serial Port hardware enabled (probably yes).

Remove everything else you have done (do this first).

Then use /dev/serial0 in any code which accesses the Serial Port.

If you want mode detail see How do I make serial work on the Raspberry Pi3 or later

Milliways
  • 62,573
  • 32
  • 113
  • 225