18 USB Serial Console
gullradriel edited this page 2024-09-09 20:38:50 +02:00

The PortaPack Mayhem firmware exposes a serial console via USB when connected to a computer.

image

image

Any serial terminal client can be used to connect like PuTTY, minicom, screen, HTerm. There are even web based ones (Chrome&Edge, no Firefox): https://www.serialterminal.com/ or https://hackrf.app/

The terminal exposes the ChibiOS/RT Shell:

grafik

You SHOULD NOT enter HackRF mode (AKA the mode with blue screen) when using the serial console, whether with PWA app (hackrf.app) or other serial tools. That saying, you need to keep your portapack on but in normal mode (instead of entering hackrf mode) to use it.

Available Commands

  • help: lists all available commands.

    grafik

  • info: shows the ChibiOS/RT system details.

  • systime: shows the uptime in ms.

  • reboot: reboots the PortaPack. This will also work on devices where the reset button is not working.

  • dfu: reboots the PortaPack into DFU firmware upgrade mode.

  • hackrf: Starts the original HackHF firmware to use the PortaPack as HackHF.

  • sd_over_usb: Starts the SD Over USB mode.

  • flash: This is the Flash Utility.

  • screenshot: Takes a screenshot.

    grafik

  • cmd_screenframe: Replies with the screen's content. Format is 1 line / screen line, and for each pixel HEX (2 char) in the R,G,B order. So one line will be 720 + newline.

  • cmd_screenframeshort: Replies with the screen's content. Format is 1 line / screen line, and for each pixel you'll get 1 character. Format is '00RRGGBB' + 32. So for black you'll get 32 (' '). For white 95 ('_').

  • gotgps: You can send apps your current position. Format gotgps lat lon <alt> <speed> <satinuse>. Lat, lon is mandantory with '.' as a decimal separator.

  • gotorientation: You can send apps your current orientation. Format gotorientation angle. Send only integer, where 0 mean North, 90 East, 400 mean 'not set'.

  • applist: Shows the apps that can be started with appstart command. You'll get 3 parameters per line: app short name (you'll need to use this with appstart), app's full name, and app category.

  • appstart: You can start apps from the list given by the applist command. 1 paremeter needed, the app's short name. It'll stop any running apps.

  • write_memory: Writes arbitrary memory locations.

    grafik

  • read_memory: Reads arbitrary memory locations.

  • button: Simulates a button press

    • button 1: Right
    • button 2: Left
    • button 3: Down
    • button 4: Up
    • button 5: Select/Enter
    • button 6: DFU
    • button 7: Rotary Left
    • button 8: Rotary Right
  • touch: Emulates touch event (press + release). Need to pass the x y coordinates of the event, and 0 < x < screen_width, 0 < y < screen_height must be met.

  • keyboard: Emulates keypress event for the supported widgets. One parameter must be a string that has the HEX (2 char) representation of the desired key. You can send multiple characters at once. Backspace is 08. "Hello world" sent in one command: keyboard 48656C6C6F20776F726C64.

  • ls: Lists files and directories.

  • mkdir: Creates a directory.

  • unlink: Deletes a file.

  • fopen: Opens a file for reading and modification.

Note

The current position will be set to the end of the file. Use fseek 0 to move to the start of the file.

  • fseek: Sets the current position inside the currently opened file.
  • fclose: Closes the currently opened file.
  • ftruncate: Removes all content in the file behind the current position.
  • ftell: Shows the current position is the file.
  • fread: Reads n bytes from the currently opened file.

Tip

there is a faster binary read option: frb

  • fwrite: Writes bytes from the currently opened file.

291070841-9e4ecef9-89bb-4a47-be0c-710384a84a22

Tip

there is a faster binary write option: fwb

  • pmemreset: Sets all values in PMEM to default. Pass the "yes" as a parameter, that indicates you know what are you doing.
  • settingsreset: Deletes all INI files from settings folder, resetting app settings. Pass the "yes" as a parameter, that indicates you know what are you doing.
  • sysinfo: show system hardware informations.
ch>sysinfo
M0 heap: 32400
M0 stack: 407
M0 cpu%: 0
M4 heap: 0
M4 stack: 0
M0 cpu%: 0
M4 miss: 0
uptime: 15
ch>
  • radioinfo: show radio settings.
ch>radioinfo
receiver_model.target_frequency: 1090000000
receiver_model.baseband_bandwidth: 1750000
receiver_model.sampling_rate: 3072000
receiver_model.modulation: 1
receiver_model.am_configuration: 0
receiver_model.nbfm_configuration: 0
receiver_model.wfm_configuration: 0
transmitter_model.target_frequency: 1090000000
transmitter_model.baseband_bandwidth: 1750000
transmitter_model.sampling_rate: 3072000
ch>
  • sendpocsag: Opens the Pocsag TX app, and sends a message defined in the command.
addr and msglen is mandatory, other parameters has a default value.
After you send this message, there will be a prompt `send <mgslen> bytes`. then you need to send JUST that amount of bytes that will be the message.
The Pocsag TX app will start, set the desired options, and send the message.
  • setfreq: Set the radio frequency.

Parameter: target frequency in HZ.

Only works in the following RX apps: Audio, Capture, ERT, Pocsag, APRS, Level, Looking Glass, Sonde, SubGHZd, Weather.

Not supported in other apps that are using frequency range, or automatically set / hopping frequencies.