intel-aero / meta-intel-aero

Yocto layer to support Intel Aero platform
https://github.com/intel-aero/meta-intel-aero
GNU General Public License v2.0
218 stars 119 forks source link

PX4Firmware System Console Boot Log #321

Closed trgiman closed 6 years ago

trgiman commented 6 years ago

Dear all.We need to have access to boot log of PX4 running on Nuttx. I can connect to nsh shell via mavlink. But at that time Aero FC is already up and running. For externally connected FC steps are clear. Described at https://dev.px4.io/en/debug/system_console.html.

To which RX,TX pin to connect to get boot log from Aero FC. Or where to find Aero FC boot log? Eventually I do see, that when on Yocto on Aeroboard. There is setup in

/etc/systemd/system/getty.target.wants for getty\@tty1.service. Which is console of Aero FC. Is it logged somewhere?

Thank you.

zehortigoza commented 6 years ago

The Nuttx terminal is going to a UART that is not exposed outside of AeroFC. But you can change the Nuttx terminal from that UART to the telemetry UART, compile and flash a PX4 firmware that you will be able to have access to boot log and Nuttx terminal, you will have to do changes in platforms/nuttx/nuttx-configs/aerofc-v1/nsh/defconfig

trgiman commented 6 years ago

@zehortigoza thanks for recommendation. I have tried steps below. But without success. I am not sure if my understanding is correct. Could you please suggest next steps?

  1. According Aero Board Manual Telem Port = USART 5
  2. So I am trying to change Nuttx System Console to send output to USART 5 (pin RX,TX)

a) From /Firmware/ROMFS/px4fmu_common/init.d/rcS file I know that at /dev/ttyS03 starts MAVLINK protocol (running trough RX,TX pins of TELEM. Upfront I validated it by running mavlink status from NSH on Aero FC). So I disabled

set MAVLINK_F "-r 1200 -d /dev/ttyS3"

b) after compilation with these parameters mavlink was not functional trough WIFI,USB or TELEM and when I was trying to deploy new compilation by make aerofc-v1_default upload. I have got

Attempting reboot on /dev/ttyS1 with baudrate=460800...

I have recovered from this...by uploading new compilation with set MAVLINK_F "-r 1200 -d /dev/ttyS3" line allowed, to AeroBoard and running root@intel-aero:~# aerofc_update.sh aerofc-v1_default.px4

c) back in platforms/nuttx/nuttx-configs/aerofc-v1/nsh/defconfig i tried to change following parameters in

MTD Device Drivers

CONFIG_UART5_SERIAL_CONSOLE=y

CONFIG_USART6_SERIAL_CONSOLE=y

After this step. Compilation and flashing new FW. And using screen screen /dev/ttyUSB0 57600 8N1 or with 115200 baudrate I do have only messed up characters on my screen. Can you please suggest how parameters of Memory Technology Device should be chnaged? Also after performing these changes I can not use TELEM RX,TX pins for Mavlink. So I guess the output are not fragments of Mavlink protocol

�$��rG����P����rG�dn� ���rG;�0�)7���9�R��J���C�G9��J���C���� �Q��J��C��;�>i>�G�͜<:�>3 ��4��}�:#=_��ǗC��eB�}�J���C� �� Q9��G_dҋ�$�����������������������dZ6�����$��G����BlJ���C?� Q�+� J�o�C�B��> i��Grc<�]>�N �@-,��VJ;�聼9�C��eB��VWARN [load_mon] tap_esc low on stack! (292 bytes left) Q �J���C��.�

trgiman commented 6 years ago

@zehortigoza I was able to turn off Mavlink on /dev/tty3 on Nuttx (Aero FC).By editing /Firmware/ROMFS/px4fmu_common/init.d/rcS file. Modifying following section. That is great. But still can not run sysconsole on TELEM RX,TX by using USART communication via FTDI cable and screen /dev/ttyUSB0 57600 8N1:

if ver hwcmp AEROFC_V1 then commented set MAVLINK_F "-r 1200 -d /dev/ttyS3" keep MAVLINK only on /dev/ttyS1 added set MAVLINK_F none

Only start mavlink if the Benewake TFMini or LeddarOne isn't being used

                    if param greater SENS_EN_TFMINI 0
                    then
                            set MAVLINK_F none
                    fi
                    if param greater SENS_EN_LEDDAR1 0
                    then
                            set MAVLINK_F none
                    fi
            fi

So when I run screen /dev/ttyUSB0 57600 8N1 there is no traffic on TELEM RX,TX pins. And nsh> mavlink status is showing only results below. This is great. By the way where in the script Mavlink is started on /dev/ttyS1 @921600

instance #0: GCS heartbeat: 815745 us ago mavlink chan: #0 type: GENERIC LINK OR RADIO flow control: ON rates: tx: 41.507 kB/s txerr: 0.000 kB/s rx: 0.021 kB/s rate mult: 1.000 ULog rate: 46.7% of max 70.0% accepting commands: YES, FTP enabled: YES MAVLink version: 2 transport protocol: serial (/dev/ttyS1 @921600)

But I am still not able to successfully change platforms/nuttx/nuttx-configs/aerofc-v1/nsh/defconfig

I have tried to switch on separately following options

CONFIG_UART5_SERIAL_CONSOLE=y CONFIG_USART2_SERIAL_CONSOLE=y

both resulted in situation that I had to undo the parameters and use root@intel-aero:~# aerofc_update.sh aerofc-v1_default.px4 with newly compiled aerofc-v1_default.px4 that I copied on Intel Aero Board.

zehortigoza commented 6 years ago

This https://github.com/zehortigoza/PX4Firmware/commit/fa280818924a63e3a4f8e40ca2a436f5230343b8 used to work a few months ago but looks like it is the same thing that you did. Make sure you do a make clean after changing defconfig

trgiman commented 6 years ago

@zehortigoza thanks a lot. I simply forgot to change CONFIG_UART5_BAUD=57600 to 57600 value. Everything is working as expected.I can access the systemconsole. So we can close the issue. But I am still wondering where in the /Firmware/ROMFS/px4fmu_common/init.d/rcS file is defined, that mavlink should start at /dev/ttyS1. As one can see when from nsh we run mavlink status. Any suggestions?

instance #0: GCS heartbeat: 684457 us ago mavlink chan: #0 type: GENERIC LINK OR RADIO flow control: ON rates: tx: 41.833 kB/s txerr: 0.000 kB/s rx: 0.021 kB/s rate mult: 1.000 ULog rate: 46.7% of max 70.0% accepting commands: YES, FTP enabled: YES MAVLink version: 2 transport protocol: serial (/dev/ttyS1 @921600)

System console is working well

image

zehortigoza commented 6 years ago

https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/4070_aerofc#L79

Then search for SYS_COMPANION in the main script.

trgiman commented 6 years ago

Thanks. Perfect. I got it