Skip to content

Commit

Permalink
Merge pull request #14 from labscript-suite/program-command
Browse files Browse the repository at this point in the history
Add program ('prg') command
  • Loading branch information
dihm authored May 28, 2024
2 parents 3e4adc6 + 6245d9d commit f24c906
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ These commands must be run when the running status is `STOPPED`.

* `clk <src (0: internal, 1: external)> <freq (in decimal Hz)>` - Sets the system clock and frequency. Maximum frequency allowed is 133 MHz. Default is 100 MHz internal clock. External clock frequency input is GPIO pin 20.
* `frq` - Measure and print system frequencies.
* `prg` - Equivalent to disconnecting the Pico, holding down the "bootsel" button, and reconnecting the Pico. Places the Pico into firmware flashing mode; the PrawnDO serial port should disappear and the Pico should mount as a mass storage device.

The basis of the functionality for this serial interface was developed by Carter Turnbaugh.

Expand Down
6 changes: 5 additions & 1 deletion prawn_do/prawn_do.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <string.h>
#include <math.h>
#include <stdint.h>
#include "pico/bootrom.h"
#include "pico/stdio.h"
#include "pico/stdlib.h"
#include "pico/multicore.h"
Expand All @@ -13,7 +14,6 @@
#include "hardware/structs/clocks.h"



#include "prawn_do.pio.h"
#include "fast_serial.h"

Expand Down Expand Up @@ -699,6 +699,10 @@ int main(){
else if(strncmp(serial_buf, "frq", 3) == 0) {
measure_freqs();
}
// Reboot into programming mode
else if(strncmp(serial_buf, "prg", 3) == 0) {
reset_usb_boot(0, 0);
}
else{
fast_serial_printf("Invalid command: %s\r\n", serial_buf);
}
Expand Down

0 comments on commit f24c906

Please sign in to comment.