Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add program ('prg') command #14

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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