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

Send 'set gal type' before reading PES info bytes. Fixes issue 16 #17

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 4 additions & 0 deletions afterburner.ino
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ typedef enum {
LAST_GAL_TYPE //dummy
} GALTYPE;

// help message for command g; must match enum above
#define GALTYPE_HELPSTR "g1=GAL16V8 g2=GAL20V8 g3=GAL22V10 g4=ATF16V8B g5=ATF22V10B g6=ATF22V10C"

// config bit numbers

Expand Down Expand Up @@ -240,6 +242,8 @@ void printHelp(char full) {
Serial.println(F("commands:"));
Serial.println(F(" h - print help"));
Serial.println(F(" e - toggle echo"));
Serial.println(F(" g - set GAL type"));
Serial.println(F(" " GALTYPE_HELPSTR));
Serial.println(F(" p - read & print PES"));
Serial.println(F(" r - read & print fuses"));
Serial.println(F(" u - upload fuses"));
Expand Down
14 changes: 13 additions & 1 deletion src_pc/afterburner.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,18 +774,30 @@ static char operationWriteOrVerify(char doWrite) {


static char operationReadInfo(void) {

char buf[MAX_LINE];
char result;

if (openSerial() != 0) {
return -1;
}

// Set gal type
sprintf(buf, "g%d\r", (int) gal);
if (verbose) {
printf("sending 'g' command...\n");
}
result = sendGenericCommand(buf, "set gal type failed ?", 4000, 0);
if (result) {
goto finish;
}

// Read info
if (verbose) {
printf("sending 'p' command...\n");
}
result = sendGenericCommand("p\r", "info failed ?", 4000, 1);

finish:
closeSerial();
return result;
}
Expand Down