Friday, June 22, 2018

PX4 on STM32F4Discovery

We'll try to run the PX4 firmware on the STM32F4Discovery board.  Some documentation can be found here.   We'll try to run everything from Linux.

First, we build the PX4 bootloader for f4discovery.  There is a specific makefile target, make px4discovery_bl.  To flash the bootloader, we can use texane stlink, which we will build.  After installing it, we can run stlink-gui and download the bootloader through the mini USB port, detected as STMicroelectronics ST-LINK/V2.

Then we build the PX4 firmware with make px4-stm32f4discovery_default.  We connect to the micro USB port; it is detected as PX4 BL DISCOVERY and /dev/ttyACM0 port is created.  To flash, make px4-stm32f4discovery_default upload.

Connect a USB Serial adapter to PA3 (RX) and PA2 (TX), and run screen /dev/ttyUSB0 57600 to access NuttX terminal.  The boot message, 

sercon: Registering CDC/ACM serial driver
sercon: Successfully registered the CDC/ACM serial driver
HW arch: PX4_STM32F4DISCOVERY
FW git-hash: 7a82c777b28c49b3476be3da716984e6bdc987a9
FW version: 7.82.77 0 (122834176)
OS: NuttX
OS version: Release 7.22.0 (118882559)
OS git-hash: 63775322bf25adb406594f8e610122fe0cef2f7a
Build datetime: Jun 22 2018 22:25:57
Build uri: BUILD_URI
Toolchain: GNU GCC, 4.9.3 20150529 (prerelease)
MFGUID: 3138343532314719002e0034
MCU: STM32F???, rev. Z
UID: 2E0034:32314719:31383435
nsh: mount: mount failed: No such file or directory
nsh: tone_alarm: command not found
nsh: mkfatfs: mkfatfs failed: No such file or directory
nsh: tone_alarm: command not found
nsh: tune_control: command not found
nsh: mtd: command not found
INFO  [param] selected parameter default file /fs/microsd/params
ERROR [param] open '/fs/microsd/params' failed (2)
nsh: rgbled: command not found
nsh: blinkm: command not found
nsh: rgbled_pwm: command not found
  BAT_N_CELLS: curr: 0 -> new: 3
ERROR [param] Parameter SYS_USE_IO not found
ERROR [param] Parameter SYS_FMU_TASK not found
ERROR [param] Parameter MNT_MODE_IN not found
ERROR [param] Parameter MNT_MODE_OUT not found
nsh: dataman: command not found
nsh: gps: command not found
nsh: fmu: command not found
nsh: fmu: command not found
nsh: ms5611: command not found
nsh: ms5611: command not found
nsh: bst: command not found
nsh: adc: command not found
ERROR [param] Parameter SENS_EN_LL40LS not found
ERROR [param] Parameter SENS_EN_LL40LS not found
ERROR [param] Parameter SENS_EN_SF0X not found
ERROR [param] Parameter SENS_EN_SF1XX not found
ERROR [param] Parameter SENS_EN_MB12XX not found
ERROR [param] Parameter SENS_EN_TRANGER not found
ERROR [param] Parameter SENS_EN_TFMINI not found
ERROR [param] Parameter SENS_EN_LEDDAR1 not found
nsh: sensors: command not found
nsh: commander: command not found
nsh: send_event: command not found
nsh: load_mon: command not found
ERROR [param] Parameter UAVCAN_ENABLE not found
ERROR [param] Parameter SENS_EN_LL40LS not found
ERROR [param] Parameter TRIG_MODE not found
nsh: fmu: command not found
nsh: tune_control: command not found
nsh: mavlink: command not found
nsh: mavlink: command not found
ERROR [param] Parameter UAVCAN_ENABLE not found
nsh: mavlink: command not found
nsh: navigator: command not found
No autostart ID found
nsh: ekf2: command not found
nsh: tone_alarm: command not found
ERROR [param] Parameter MNT_MODE_IN not found
nsh: vmount: command not found
ERROR [param] Parameter SDLOG_MODE not found
ERROR [param] Parameter SDLOG_MODE not found
nsh: logger: command not found
nsh: mavlink: command not found

NuttShell (NSH)
nsh> ERROR [parameters] failed to open param file: /fs/microsd/params
ERROR [parameters] param save failed (-1)

nsh> help
help usage:  help [-v] [<cmd>]

  [           dirname     free        mkrd        rmdir       umount
  ?           date        help        mh          set         unset
  basename    dd          hexdump     mount       sh          usleep
  break       df          kill        mv          sleep       xd
  cat         echo        ls          mw          test
  cd          exec        mb          ps          time
  cp          exit        mkdir       pwd         true
  cmp         false       mkfatfs     rm          uname

Builtin Apps:
  cu
  bl_update
  config
  mixer
  nshterm
  param
  perf
  px4_simple_app
  reboot
  top
  uorb
  ver
  sercon
  serdis
nsh> ver all
HW arch: PX4_STM32F4DISCOVERY
FW git-hash: 7a82c777b28c49b3476be3da716984e6bdc987a9
FW version: 7.82.77 0 (122834176)
OS: NuttX
OS version: Release 7.22.0 (118882559)
OS git-hash: 63775322bf25adb406594f8e610122fe0cef2f7a
Build datetime: Jun 22 2018 22:25:57
Build uri: BUILD_URI
Toolchain: GNU GCC, 4.9.3 20150529 (prerelease)
MFGUID: 3138343532314719002e0034
MCU: STM32F???, rev. Z
UID: 2E0034:32314719:31383435
nsh>

No comments:

Post a Comment