Difference between revisions of "RPi"

From GIMX
Jump to: navigation, search
(Hardware requirements)

(39 intermediate revisions by 5 users not shown)

Line 2: Line 2:
 
<translate>
 
<translate>
 
<!--T:1-->
 
<!--T:1-->
'''Warning: RPi support should be considered as experimental. Be prepared to face issues if you try GIMX on the RPi.'''
+
'''Warning: RPi support should be considered as experimental. The USB controller has been unstable since the first version. Be prepared to face issues if you try GIMX on the RPi.'''
  
 
GIMX can run on many Linux targets, and the [http://www.raspberrypi.org/ the Raspberry Pi] is one of them!
 
GIMX can run on many Linux targets, and the [http://www.raspberrypi.org/ the Raspberry Pi] is one of them!
== Tested setup == <!--T:2-->
 
* Raspberry Pi: model B, 256MB
 
* Distro: [http://www.raspberrypi.org/downloads Raspbian Jessie] (2015-09-24)
 
* '''Self-powered USB hub''': Belkin 7 ports F4U017 (self-powered = with an external power supply)
 
* Keyboard: n25te plugged on the USB hub
 
* Mouse: Logitech G500 plugged on the USB hub
 
* PS3: FAT - FW 4.41
 
  
<!--T:3-->
+
== Setup using pre-made image == <!--T:23-->
* Bluetooth dongle: Pluscom BT20 (CSR Bluecore4-rom) plugged on the USB hub
 
  
<!--T:4-->
+
<!--T:24-->
* DIY USB adapter: Teensy 2.0 + CP2102 plugged on the USB hub
+
The simplest way to set up GIMX on a Raspberry Pi is by flashing a pre-made image. See forum user steel_3d's instructions on getting up and running: [http://www.steve-marton.com/gimx/?p=462 Build your own Plug n Play GIMX emulator using Raspberry Pi]
  
== Firmware update == <!--T:5-->
+
== Hardware considerations == <!--T:23-->
As early firmwares had severe USB issues it is recommended to update the firmware before using GIMX.<br />
 
Updating the firmware may also be useful if you plan to use a Logitech force feedback wheel (the uhid kernel module was missing in earlier firmwares).<br />
 
Type the following command:
 
<pre>sudo rpi-update</pre>
 
And don't forget to reboot:
 
<pre>sudo reboot</pre>
 
Tested Rpi firmware:
 
<pre>pi@raspberrypi ~ $ uname -a
 
Linux raspberrypi 4.1.9+ #819 PREEMPT Thu Oct 1 20:31:26 BST 2015 armv6l
 
GNU/Linux</pre>
 
<!--== UHID kernel module ==
 
  
<!--T:6-->
+
<!--T:24-->
If you plan to use a Logitech force feedback wheel, you will have to build the uhid.ko module for your kernel.<br />
+
Use a USB HUB only if there are no ports available on the RPi.<br />
Install the right version of gcc, as explained here: [https://github.com/notro/rpi-source/wiki link].<br />
+
It is highly recommended to use a HUB with an external power supply.
Update your kernel:
+
 
<pre>sudo rpi-update</pre>
+
== USB adapter using the on-board UART interface == <!--T:6-->
In case the kernel was updated, reboot:
+
 
<pre>sudo reboot</pre>
+
=== Hardware requirements === <!--T:25-->
Install the rpi-source tool:
+
 
<pre>sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update</pre>
+
<!--T:26-->
Run rpi-source:
+
The on-board UART runs at 0V/3.3V levels, and the AVR USB board has to run at 5V to operate at 16MHz (running at 3.3V would only allow to operate at 8MHz).<br />
<pre>rpi-source</pre>
+
Connecting the RPi and the AVR USB board directly may damage the hardware!<br />
This step may take a while to complete.<br />
+
One cheap solution is to use a voltage divider:<br />
Install ncurses:
+
* Connect both GNDs
<pre>sudo apt-get install libncurses5-dev</pre>
+
* It's safe to connect the TXD pin of the RPi to the Rx pin of the AVR USB board (the GIMX firmwares configure the Rx pin as an input)
Enable the UHID module compilation:
+
* To connect the Tx pin of the AVR USB board to the RXD pin of the RPi, you'll need to convert the voltage level from 0..5V to 0..3.3V.<br />
<pre>cd linux
+
This can be done with a simple resistive divider:
make menuconfig</pre>
+
<div class="image200px">[https://gimx.fr/img/wiki/Resistive_divider.png https://gimx.fr/img/wiki/Resistive_divider.png]</div>
Select Device Drivers>HID support>User-space I/O driver support for HID subsystem. The line should start with '<M>'.<br />
+
Vin is the Tx pin of the AVR USB board, Vout is the RXD pin of the RPi, R1=2.2kΩ , R2=3.3kΩ
To speed up the compilation, you can disable all other modules in the HID support section and subsections.<br />
+
* Do not connect any other pin!
Save the config to the default location and exit.<br />
+
 
Build the module:
+
=== Sotware adjustments === <!--T:15-->
<pre>make prepare
+
 
make scripts
+
<!--T:17-->
make M=drivers/hid</pre>
+
By default, the RPi UART is configured as a serial console.<br />
Install it:
+
Disable this serial console using raspi-config:
<pre>sudo cp drivers/hid/uhid.ko /lib/modules/`uname -r`/kernel/drivers/hid/
+
<pre>
sudo depmod -a</pre>-->
+
sudo raspi-config
<!--mkdir dest
+
</pre>
make INSTALL_HDR_PATH=dest headers_install
+
Then select:
sudo cp dest/include/linux/uhid.h /usr/include/linux/-->
+
<pre>
 +
"Advanced Options", "Serial", "No", "Finish"
 +
</pre>
 +
The default configuration does not allow high baudrates.<br />
 +
Enable high baudrates editing /boot/config.txt:
 +
<pre>
 +
sudo nano /boot/config.txt
 +
</pre>
 +
Add the following line at the end of the file:
 +
<pre>
 +
init_uart_clock=8000000
 +
</pre>
 +
Reboot to apply the changes:
 +
<pre>
 +
sudo reboot
 +
</pre>
  
 
== GIMX installation == <!--T:7-->
 
== GIMX installation == <!--T:7-->
<pre>sudo apt-get install gdebi
+
<pre>wget https://gimx.fr/download/gimx-raspbian -O gimx.deb
wget http://gimx.fr/download/gimx-raspbian -O gimx.deb
+
sudo dpkg -i gimx.deb
sudo gdebi gimx.deb</pre>
+
sudo apt-get update && sudo apt-get -f install</pre>
  
 
<!--T:8-->
 
<!--T:8-->
 
If you get a "Dependency is not satisfiable: ..." error message, upgrade Raspbian:
 
If you get a "Dependency is not satisfiable: ..." error message, upgrade Raspbian:
<pre>sudo apt-get update && sudo apt-get upgrade</pre>
+
<pre>sudo apt-get update && sudo apt-get upgrade
 +
sudo apt-get -f install</pre>
  
 
== Stop/disable triggerhappy service == <!--T:9-->
 
== Stop/disable triggerhappy service == <!--T:9-->
Line 86: Line 83:
 
== Run GIMX == <!--T:12-->
 
== Run GIMX == <!--T:12-->
 
Read the [[Quick_Start|Quick start page]] to learn how to run GIMX through the GUI.<br />
 
Read the [[Quick_Start|Quick start page]] to learn how to run GIMX through the GUI.<br />
A good idea is to run GIMX directly from a terminal, without starting a graphical session.<br />
+
 
This can be done over the network, using a ssh client.<br />
+
A good idea is to run GIMX directly from a terminal, without starting a graphical session, which can be done over the network, using a ssh client, or you can [[#Autostart GIMX at boot without GUI]]<br />
Ideally, GIMX should be launched without using the Ethernet port (because it is connected on the USB bus).<br />
+
 
 +
Ideally, GIMX should be launched without using the Ethernet port (because it is connected on the USB bus). However, this doesn't seem to cause any issues generally.<br />
 +
 
 
More details on command line options on [[Command_line|this page]].<br />
 
More details on command line options on [[Command_line|this page]].<br />
=== Bluetooth ===
 
In a terminal:
 
gimx -t Sixaxis -c <config file> -b <PS3 bdaddr>
 
The dongle address has to be changed before running the above commands.
 
  
=== DIY USB adapter === <!--T:13-->
+
The GUI will help you download the config xmls. If you never run the GUI, you MUST grab the Linux config xmls from here: https://github.com/matlo/GIMX-configurations/tree/master/Linux  The Windows xmls are NOT compatible!<br />
In a terminal:
+
 
gimx -c <config file> -p /dev/<ttyUSB port>
+
== Autostart GIMX at boot without GUI == <!--T:28-->
 +
Simply create a file /etc/systemd/system/gimx.service (as root):  
 +
 
 +
<pre>
 +
sudo nano /etc/systemd/system/gimx.service
 +
</pre>
 +
 
 +
With the following contents:
 +
 
 +
<!--T:29-->
 +
<pre>
 +
[Unit]
 +
Description=GIMX 
 +
After=syslog.target network.target
 +
 
 +
<!--T:30-->
 +
[Service]
 +
User=pi 
 +
Type=simple 
 +
# Replace /dev/ttyUSB0 with /dev/ttyAMA0 when using the on-board UART interface
 +
ExecStart=/usr/bin/gimx -p /dev/ttyUSB0 -c LogitechDrivingForceGT_G29.xml --nograb 
 +
Restart=always 
 +
RestartSec=5
  
 +
<!--T:31-->
 +
[Install]
 +
WantedBy=multi-user.target
 +
</pre>
  
=== USB adapter using the on-board UART interface ===
+
<!--T:32-->
 +
Replace ttyUSB0 with your device (/dev/ttyAMA0 when using the on-board UART interface) and LogitechDrivingForceGT_G29.xml with your mapping file (which should be available in the pi home directory as /home/pi/.gimx/config/LogitechDrivingForceGT_G29.xml)
  
==== Hardware requirements ====
+
<!--T:33-->
 +
Run <pre>sudo systemctl daemon-reload</pre> to notify systemd about the new file and <pre>sudo systemctl enable gimx && sudo systemctl start gimx</pre> to enable the gimx service start at boot and start it in the same line.
  
The on-board UART runs at 0V/3.3V levels, and the AVR USB board has to run at 5V to operate at 16MHz (running at 3.3V would only allow to operate at 8MHz).<br />
+
== Notify when GIMX is running using a led == <!--T:34-->
Connecting the RPi and the AVR USB board directly may damage the hardware!<br />
+
In order to have a proper confirmation about if the gimx service is up and running, you can add a simple python script that turns a led on if the gimx service is running.
One cheap solution is to use a voltage divider:<br />
 
* Connect both GNDs
 
* It's safe to connect the TXD pin of the RPi to the Rx pin of the AVR USB board (the GIMX firmwares configure the Rx pin as an input)
 
* To connect the Tx pin of the AVR USB board to the RXD pin of the RPi, you'll need to convert the voltage level from 0..5V to 0..3.3V.<br />
 
This can be done with a simple resistive divider:
 
<div class="image200px">[http://gimx.fr/img/wiki/Resistive_divider.png http://gimx.fr/img/wiki/Resistive_divider.png]</div>
 
Vin is the Tx pin of the AVR USB board, Vout is the RXD pin of the RPi, R1=2.2kΩ , R2=3.3kΩ
 
* Do not connect any other pin!
 
  
=== Without DIY USB adapter (RU) === <!--T:14-->  
+
<!--T:35-->
 +
The file will be located at /home/pi/blink.py:
  
====Подготовка RPi==== <!--T:15-->
+
<pre>sudo nano blink.py</pre>
  
<!--T:16-->
+
With the following contents:
Нам подойдет любая из моделей RPi:
 
Raspberry Pi A+
 
Raspberry Pi B
 
Raspberry Pi B+
 
Raspberry Pi 2
 
Raspberry Pi Zero
 
  
<!--T:17-->
+
<!--T:36-->
По умолчанию RPi отправляет отладочные сообщения на последовательный порт.
 
Что бы использовать последовательный порт для своих нужд необходимо выполнить команду в терминале:
 
 
<pre>
 
<pre>
sudo raspi-config
+
#!/usr/bin/python
 +
import os 
 +
import time 
 +
import RPi.GPIO as GPIO
 +
 
 +
<!--T:37-->
 +
led = 23 
 +
button = 18 
 +
GPIO.setmode(GPIO.BCM) 
 +
GPIO.setup(led, GPIO.OUT) 
 +
GPIO.setup(button, GPIO.IN, pull_up_down = GPIO.PUD_UP)
 +
 
 +
<!--T:38-->
 +
def Shutdown(channel): 
 +
  GPIO.output(led, True)
 +
  time.sleep(0.2)
 +
  GPIO.output(led, False)
 +
  time.sleep(0.2)
 +
  GPIO.output(led, True)
 +
  time.sleep(0.2)
 +
  GPIO.output(led, False)
 +
  os.system("sudo shutdown -h now")
 +
 
 +
<!--T:39-->
 +
GPIO.add_event_detect(18, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
 +
 
 +
<!--T:40-->
 +
while True: 
 +
  found = False
 +
  time.sleep(5)
 +
  pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
 +
  for pid in pids:
 +
    try:
 +
      cmd = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
 +
      if "gimx" in cmd:
 +
        found = True
 +
    except IOError: # proc has already terminated
 +
      continue
 +
  if found == True:
 +
    GPIO.output(led, True)
 +
  else:
 +
    GPIO.output(led, False)
 
</pre>
 
</pre>
Откроется gрограмма конфигурации
+
 
Выберем пункт:
+
<!--T:41-->
 +
As a bonus, you can add a button so when it is pressed, there is a little blink effect, and the pi is shutted down.
 +
 
 +
<!--T:42-->
 +
<div class="image200px">[https://gimx.fr/img/wiki/PiButtonLed.png https://gimx.fr/img/wiki/PiButtonLed.png]</div>
 +
 
 +
<!--T:43-->
 +
To start at boot, simply add it to the pi user crontab (crontab -e) as <pre>@reboot python /home/pi/blink.py &</pre>
 +
 
 +
== Powering on AVR and RPi simultaneously using the on-board UART interface  == <!--T:44-->
 +
In case you want to power up AVR (Tested on Pro Micro ATmega32u4) and RPi at once (i.e. using PS4 USB port and a USB Y Splitter) using the on-board UART interface, you will need the adjust shown below in order to reset the AVR board from RPi once started.
 +
 
 +
<!--T:45-->
 +
It is planned to solve this issue on GIMX 8 version [https://github.com/matlo/GIMX/issues/426]
 +
 
 +
<!--T:46-->
 +
More details on support forum thread [https://gimx.fr/forum/viewtopic.php?f=5&t=1672]
 +
 
 +
<!--T:47-->
 +
'''Physically'''
 +
* RPi's PIN40 / GPIO21 connected to ATmega32u4 RST pin directly. (Any RPi GPIO pin should works)
 +
 
 +
<!--T:48-->
 +
'''Logically'''
 +
* New bash script created /home/pi/resetArduino.sh with content shown below:
 
<pre>
 
<pre>
"Advanced Options" затем выберем "Serial" затем "No" затем "Finish"
+
#!/bin/bash
 +
 
 +
echo 21 > /sys/class/gpio/export
 +
sleep 1
 +
echo out > /sys/class/gpio/gpio21/direction
 +
sleep 1
 +
echo 1 > /sys/class/gpio/gpio21/value
 +
sleep 1
 +
echo 0 > /sys/class/gpio/gpio21/value
 +
sleep 1
 +
echo 1 > /sys/class/gpio/gpio21/value
 +
 
 +
exit 0
 
</pre>
 
</pre>
Но этого не достаточно. По умолчанию частота последовательного порта 3 MHz поднимем её до 8 MHz.  
+
* Grant execution permissions
Выполним команду в терминале:
+
<pre>chmod +x /home/pi/resetArduino.sh</pre>
 +
* Add the new script to boot sequence (like we do with blink.py program)
 
<pre>
 
<pre>
sudo nano /boot/config.txt
+
pi@raspberrypi:~ $ crontab -l
</pre>
+
@reboot /home/pi/resetArduino.sh && python /home/pi/blink.py &
Добавим строку (если она существует просто поправте ее значение)
 
<pre>
 
init_uart_clock=8000000
 
</pre>
 
Установим GIMX для этого выполним последовательно команды в терминале:
 
<pre>
 
sudo apt-get install gdebi
 
wget http://gimx.fr/download/gimx-raspbian -O gimx.deb
 
sudo gdebi gimx.deb
 
sudo service triggerhappy stop
 
sudo update-rc.d triggerhappy disable
 
sudo reboot
 
</pre>
 
После того как перезагрузится RPi (если она загрузится не в X) выполним команду в терминале:
 
<pre>
 
startx
 
</pre>
 
И сделаем ссылку на AMA0
 
<pre>
 
sudo ln -s /dev/ttyAMA0 /dev/ttyUSB0
 
 
</pre>
 
</pre>
  
==== Схема подключения ==== <!--T:22-->
+
Using this configuration, GIMX is able to start correctly on its first attempt when RPi and ATmega32u4 are powered on from PS4 simultaneously using GPIO instead of CP2102 USB UART.
Данная схема работает только у меня!!!
+
 
Как сказал автор опасно применять схему, из за 5 вольт на UART Teensy возможно это можно решить прошивкой...<br>
 
Либо делителем описание тут [http://gimx.fr/forum/viewtopic.php?p=4485#p4485]<br>
 
 
</translate>
 
</translate>

Revision as of 10:30, 16 March 2019

Other languages:
Deutsch • ‎English • ‎français

Warning: RPi support should be considered as experimental. The USB controller has been unstable since the first version. Be prepared to face issues if you try GIMX on the RPi.

GIMX can run on many Linux targets, and the the Raspberry Pi is one of them!

Setup using pre-made image

The simplest way to set up GIMX on a Raspberry Pi is by flashing a pre-made image. See forum user steel_3d's instructions on getting up and running: Build your own Plug n Play GIMX emulator using Raspberry Pi

Hardware considerations

Use a USB HUB only if there are no ports available on the RPi.
It is highly recommended to use a HUB with an external power supply.

USB adapter using the on-board UART interface

Hardware requirements

The on-board UART runs at 0V/3.3V levels, and the AVR USB board has to run at 5V to operate at 16MHz (running at 3.3V would only allow to operate at 8MHz).
Connecting the RPi and the AVR USB board directly may damage the hardware!
One cheap solution is to use a voltage divider:

  • Connect both GNDs
  • It's safe to connect the TXD pin of the RPi to the Rx pin of the AVR USB board (the GIMX firmwares configure the Rx pin as an input)
  • To connect the Tx pin of the AVR USB board to the RXD pin of the RPi, you'll need to convert the voltage level from 0..5V to 0..3.3V.

This can be done with a simple resistive divider:

Resistive_divider.png

Vin is the Tx pin of the AVR USB board, Vout is the RXD pin of the RPi, R1=2.2kΩ , R2=3.3kΩ

  • Do not connect any other pin!

Sotware adjustments

By default, the RPi UART is configured as a serial console.
Disable this serial console using raspi-config:

sudo raspi-config 

Then select:

"Advanced Options", "Serial", "No", "Finish"

The default configuration does not allow high baudrates.
Enable high baudrates editing /boot/config.txt:

sudo nano /boot/config.txt

Add the following line at the end of the file:

init_uart_clock=8000000 

Reboot to apply the changes:

sudo reboot

GIMX installation

wget https://gimx.fr/download/gimx-raspbian -O gimx.deb
sudo dpkg -i gimx.deb
sudo apt-get update && sudo apt-get -f install

If you get a "Dependency is not satisfiable: ..." error message, upgrade Raspbian:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get -f install

Stop/disable triggerhappy service

Triggerhappy is a daemon that opens every input device for reading, and that consumes a few percent of the CPU time.

It seems a good idea to stop it while running GIMX.

To stop triggerhappy:

sudo service triggerhappy stop

To disable triggerhappy:

sudo update-rc.d triggerhappy disable

Run GIMX

Read the Quick start page to learn how to run GIMX through the GUI.

A good idea is to run GIMX directly from a terminal, without starting a graphical session, which can be done over the network, using a ssh client, or you can #Autostart GIMX at boot without GUI

Ideally, GIMX should be launched without using the Ethernet port (because it is connected on the USB bus). However, this doesn't seem to cause any issues generally.

More details on command line options on this page.

The GUI will help you download the config xmls. If you never run the GUI, you MUST grab the Linux config xmls from here: https://github.com/matlo/GIMX-configurations/tree/master/Linux The Windows xmls are NOT compatible!

Autostart GIMX at boot without GUI

Simply create a file /etc/systemd/system/gimx.service (as root):

sudo nano /etc/systemd/system/gimx.service

With the following contents:

[Unit]
Description=GIMX  
After=syslog.target network.target

[Service]
User=pi  
Type=simple  
# Replace /dev/ttyUSB0 with /dev/ttyAMA0 when using the on-board UART interface
ExecStart=/usr/bin/gimx -p /dev/ttyUSB0 -c LogitechDrivingForceGT_G29.xml --nograb  
Restart=always  
RestartSec=5

[Install]
WantedBy=multi-user.target

Replace ttyUSB0 with your device (/dev/ttyAMA0 when using the on-board UART interface) and LogitechDrivingForceGT_G29.xml with your mapping file (which should be available in the pi home directory as /home/pi/.gimx/config/LogitechDrivingForceGT_G29.xml)

Run

sudo systemctl daemon-reload

to notify systemd about the new file and

sudo systemctl enable gimx && sudo systemctl start gimx

to enable the gimx service start at boot and start it in the same line.

Notify when GIMX is running using a led

In order to have a proper confirmation about if the gimx service is up and running, you can add a simple python script that turns a led on if the gimx service is running.

The file will be located at /home/pi/blink.py:

sudo nano blink.py

With the following contents:

#!/usr/bin/python
import os  
import time  
import RPi.GPIO as GPIO

led = 23  
button = 18  
GPIO.setmode(GPIO.BCM)  
GPIO.setup(led, GPIO.OUT)  
GPIO.setup(button, GPIO.IN, pull_up_down = GPIO.PUD_UP)

def Shutdown(channel):  
  GPIO.output(led, True)
  time.sleep(0.2)
  GPIO.output(led, False)
  time.sleep(0.2)
  GPIO.output(led, True)
  time.sleep(0.2)
  GPIO.output(led, False)
  os.system("sudo shutdown -h now")

GPIO.add_event_detect(18, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)

while True:  
  found = False
  time.sleep(5)
  pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
  for pid in pids:
    try:
      cmd = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
      if "gimx" in cmd:
        found = True
    except IOError: # proc has already terminated
      continue
  if found == True:
    GPIO.output(led, True)
  else:
    GPIO.output(led, False)

As a bonus, you can add a button so when it is pressed, there is a little blink effect, and the pi is shutted down.

PiButtonLed.png

To start at boot, simply add it to the pi user crontab (crontab -e) as

@reboot python /home/pi/blink.py &

Powering on AVR and RPi simultaneously using the on-board UART interface

In case you want to power up AVR (Tested on Pro Micro ATmega32u4) and RPi at once (i.e. using PS4 USB port and a USB Y Splitter) using the on-board UART interface, you will need the adjust shown below in order to reset the AVR board from RPi once started.

It is planned to solve this issue on GIMX 8 version [1]

More details on support forum thread [2]

Physically

  • RPi's PIN40 / GPIO21 connected to ATmega32u4 RST pin directly. (Any RPi GPIO pin should works)

Logically

  • New bash script created /home/pi/resetArduino.sh with content shown below:
#!/bin/bash

echo 21 > /sys/class/gpio/export
sleep 1
echo out > /sys/class/gpio/gpio21/direction
sleep 1
echo 1 > /sys/class/gpio/gpio21/value
sleep 1
echo 0 > /sys/class/gpio/gpio21/value
sleep 1
echo 1 > /sys/class/gpio/gpio21/value

exit 0
  • Grant execution permissions
chmod +x /home/pi/resetArduino.sh
  • Add the new script to boot sequence (like we do with blink.py program)
pi@raspberrypi:~ $ crontab -l
@reboot /home/pi/resetArduino.sh && python /home/pi/blink.py &

Using this configuration, GIMX is able to start correctly on its first attempt when RPi and ATmega32u4 are powered on from PS4 simultaneously using GPIO instead of CP2102 USB UART.