Choose USB Port on Raspberry?

I have a fresh installation of version 10.0 and it does not work with megatronics or MKS base 1.6… when flashing, it says " found tty: ttyAMA0 for firmware flash" however the serial port used is ttyUSB0. Anyway to choose the right port for the RAMPS compatible card ?


10:41:35.053 [info] usb 1-1.4: new full-speed USB device number 5 using dwc_otg
10:41:35.240 [info] usb 1-1.4: New USB device found, idVendor=0403, idProduct=6001,bcdDevice= 6.00
10:41:35.240 [info] usb 1-1.4: New USB device strings: Mfr=1, Product=2,SerialNumber=3
10:41:35.240 [info] usb 1-1.4: Product: FT232R USB UART
10:41:35.241 [info] usb 1-1.4: Manufacturer: FTDI
10:41:35.255 [info] usb 1-1.4: SerialNumber: AL035T40
10:41:35.303 [info] ftdi_sio 1-1.4:1.0: FTDI USB Serial Device converter detected
10:41:35.303 [info] usb 1-1.4: Detected FT232RL
10:41:35.303 [info] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
10:41:35.497 [debug] firmware interface already detected: ttyAMA0

Try using Farmbot OS version 9.2.2, I’ve expected the same log output when using v10.0.0. Connect the raspberry with the webapp under v9.2.2 and make an OTA update then, your arduino will keep the firmware even under v10.0.0. That’s how its working for me at least.

@GillesF I am assuming you are using an off-the-shelf board rather than an official one. If the 3rd party board you are using exposes both *USB0 and *AMA0, it will not work. FBOS was designed to detect exactly one serial port and currently has no means of dealing with setups where two USB serial ports are connected. Unless this problem is affecting official FarmBot boards, it is unlikely that I will add a fix for it, as there are higher priority issues that I need to take care of right now.

Thanks to @Ascend. it did the trick. Using version 9.2.2, the pi was able to find correctly the card, then update it.
@RickCarlino : I confirm that the 3rd party board is not exposing the serial port twice according to the log and the tests I did on a raspbian. However the version 9.2.2 works nicely. I believe that the ttyAMA0 is the UART port on the GPIO pins of the Raspberry.
Let me know if there is anything I can do to help confirming this. I am pretty sure I will not be the only one in the case.

I’m also running on a 3rd party board (MKS Gen 1.4) which is the arduino mega2560/ramps board in one board. I wasn’t able to find time yet to try flashing the firmware from FBOS10 to a regular mega2560/ramps stack as they were used in Genesis 1.2, but I believe that those devices can also experience this issue if they reflash the OS.
Do you remember if there was any change to FBOS dealing with serial ports / UART ports or anything similar? Its weird that those boards were working nicely until V10.0.0. I think as long as this issue only affects 3rd party boards and not farmbot customers using the 1.2 kit this workaround will help out as there are probably not too many users having a non-kit setup.

@GillesF @Ascend

the 3rd party board is not exposing the serial port twice according to the log and the tests I did on a raspbian.

Raspbian uses a completely different config.txt than FBOS, so this may not be an accurate comparison. As you may have noticed from the volume of support requests on the forum, we are very busy this month and I can’t spend any time investigating this matter unless it is affecting users of official kits.

I believe that those devices [used in Genesis 1.2] can also experience this issue if they reflash the OS.

I do most of my QA testing on a v1.2 RAMPS board and did not experience any issues. I re-flashed from scratch this morning to be sure and saw no issues. I will keep an eye on this, and I welcome feedback from any forum users that are on official 1.2 hardware. We have not seen an uptick in support requests from v1.2 customers related to firmware, though I will need to double check that with Marc when he is in the office.

Do you remember if there was any change to FBOS dealing with serial ports / UART ports or anything similar?

Yes, here is what happened: As we roll out the new FarmBot Express line, some customers want more CPU power than the RPi0 can provide and wish to upgrade their CPU to an RPi3. It is possible in theory to buy a 40 pin connector and replace the RPi0 with a faster RPi3 board. It is not possible in practice, though, due to how FarmBot OS does serial detection. I would like to give customers the ability to upgrade the CPU of their Express kits so in v10.0.0, I made changes to how serial detection works to be more generic. It is still a work in progress and it is not yet possible to do an RPi upgrade on Express bots. Although the work was not complete, it was stable enough to merge and we did not observe any problems during QA for the 10.0.0 release. We performed QA checks on v1.2 devices as part of the release process and did not notice any issues.

I will keep this in mind when I re-visit this feature, which probably won’t be any time soon due to current support requests from customers and reduced staff.

It might be possible to fix the issue by changing the enable_uart value in config.txt of the boot partition, but I can’t spend any time assisting with this process, given the high number of support requests from customers using official hardware.

1 Like

Thanks @RickCarlino for the information. I modified the config.txt to remove the enable_uart and tried to push the firmware. It is still asking for a device found as ttyAMA0…
I’ll try to investigate on this although there is a workaround.


1 Like

I ran through the same issue and I made a fix in my FBOS to handle this.
In fact it was a matter of list order…
ttyAMA0 appears before ttyUSB0 in the list of available port, so farmbot use this one.
In FBOS 9.2.2, this bug was not here because for Rpi3 target, ttyAMA0 was not in the “valid port name list for farmdunio” but in FBOS 10.0.0 they added this port to the valid ones in oder the allow the upgrade from Rpi0 to Rpi3 for Express users (I think).

Anyway, here is my fix in the file farmbot_os/farmbot_core/lib/farmbot_core/firmware_tty_detector.ex

where I modified the function “handle_info” :

  def handle_info(:timeout, state) do
    enumerated = UART.enumerate() |> Map.to_list()
    # now we want to put the ttyAMA0 (if any) at the end of the list
    enumerated =
      if List.keymember?(enumerated,"ttyAMA0",0) do
        ttyserial = List.keyfind(enumerated,"ttyAMA0",0)
        enumerated = List.delete(enumerated, ttyserial)
        enumerated ++ ttyserial
    {:noreply, state, {:continue, enumerated}}

Hope this will help.
PS: I never coded in Elixir before, so there is maybe a better way, but this one works.


Thanks for investigating the @Arti4ever. If it passes QA testing and does not interfere with official FarmBot kits, I can merge this into the next release.

@Arti4ever Some unfortunate news: The fix you’ve applied will not be added to FBOS until the release of 10.1.1. We expect to release 10.1.0 tomorrow but unfortunately we saw problems with Express Farmduino behavior after applying your fix (no root cause identified due to time limitations). Because of this, we had to remove it and schedule it for a different release. Please follow our newsletter or forum announcements for a release notice.


@RickCarlino good communication.