Skip to content

Commit

Permalink
logging and dumping from FRAM working
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Shipman committed Mar 7, 2024
1 parent 1b3c91f commit e2f2923
Show file tree
Hide file tree
Showing 9 changed files with 19,925 additions and 19,920 deletions.
Binary file modified Code/BITS/BITSv5/test/build/CMakeFiles/test.dir/test.cpp.obj
Binary file not shown.
Binary file modified Code/BITS/BITSv5/test/build/test.bin
Binary file not shown.
33,082 changes: 16,539 additions & 16,543 deletions Code/BITS/BITSv5/test/build/test.dis

Large diffs are not rendered by default.

Binary file modified Code/BITS/BITSv5/test/build/test.elf
Binary file not shown.
1,505 changes: 752 additions & 753 deletions Code/BITS/BITSv5/test/build/test.elf.map

Large diffs are not rendered by default.

5,206 changes: 2,604 additions & 2,602 deletions Code/BITS/BITSv5/test/build/test.hex

Large diffs are not rendered by default.

Binary file modified Code/BITS/BITSv5/test/build/test.uf2
Binary file not shown.
Binary file added Code/BITS/BITSv5/test/build/test.uf2.textClipping
Binary file not shown.
52 changes: 30 additions & 22 deletions Code/BITS/BITSv5/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ DRF1262 radio(spi1, RADIO_CS, SCK_PIN, MOSI_PIN, MISO_PIN, TXEN_PIN, DIO1_PIN,
MB85RS1MT mem(spi1, FRAM_CS, SCK_PIN, MOSI_PIN, MISO_PIN);

static uint32_t log_addr = LOG_INIT_ADDR;
char log_str[11] = "a b c d ef";
char log_str1[11] = "h i j k lm";
uint8_t log_buf[11] = {0};
char log_str[] = "BITSv5,PRESS,TEMP,LAT,LONG,TIME\n"; // "a b c d ef"
char log_str1[] = "0,0,0,99.9999,99.9999,0000.00\n"; //"h i j k lm"
uint8_t log_buf = 0;

Config test_config;

Expand Down Expand Up @@ -104,39 +104,47 @@ int main() {
write_config(NAME, test_config, (uint8_t *)test_config.name,
sizeof(test_config.name), &mem);

printf("\n%s %s\n", __DATE__, __TIME__);

printf("BITSv5 Test (Compiled %s %s)\n", __DATE__, __TIME__);
printf("Device ID: %d\n", mem.device_id);
read_config(NAME, test_config, (uint8_t *)test_config.name,
sizeof(test_config.name), &mem);
printf("DEVICE NAME: %s\n", test_config.name);

printf("Dumping FRAM\n");
for (log_addr = LOG_INIT_ADDR; log_addr <= LOG_INIT_ADDR + 1 + 20 * (11);
log_addr = log_addr + sizeof(log_buf)) { //= log_addr + sizeof(log_buf)
for (log_addr = LOG_INIT_ADDR;
log_addr <= LOG_INIT_ADDR + 1 + 20 * (sizeof(log_str1));
log_addr++) { //= log_addr + sizeof(log_buf)
watchdog_update();
mem.read_memory(log_addr, log_buf, sizeof(log_buf)); // sizeof(log_buf)
printf("%d - %s\n", log_addr, log_buf);
memset(log_buf, 0, sizeof(log_buf));
mem.read_memory(log_addr, &log_buf, 1); // sizeof(log_buf)
if (log_buf != 0) printf("%c", log_buf);
// printf("%d - %c\n", log_addr, log_buf);
// memset(log_buf, 0, sizeof(log_buf));
log_buf = 0;
}

printf("Writing FRAM\n");
for (log_addr = LOG_INIT_ADDR; log_addr <= LOG_INIT_ADDR + 1 + 20 * (11);
log_addr = log_addr + sizeof(log_str)) {
log_addr = LOG_INIT_ADDR;
printf("\n\nWriting FRAM\n");
mem.write_memory(log_addr, (uint8_t *)log_str, sizeof(log_str));
printf("%d - %s\n", log_addr, log_str);
for (log_addr = LOG_INIT_ADDR + sizeof(log_str);
log_addr <= LOG_INIT_ADDR + 1 + 20 * (sizeof(log_str1));
log_addr = log_addr + sizeof(log_str1)) {
// printf("%d\n", log_addr);
watchdog_update();

log_str[1] = (char)get_rand_32();
log_str1[1] = (char)get_rand_32();
// log_str[1] = (char)get_rand_32();
log_str1[0] = (char)get_rand_32();

if (log_addr % 2 != 0) {
mem.write_memory(log_addr, (uint8_t *)log_str, sizeof(log_str));
printf("%d - %s\n", log_addr, log_str);
} else {
mem.write_memory(log_addr, (uint8_t *)log_str1, sizeof(log_str1));
printf("%d - %s\n", log_addr, log_str1);
}
mem.write_memory(log_addr, (uint8_t *)log_str1, sizeof(log_str1));
printf("%d - %s\n", log_addr, log_str1);

// if (log_addr % 2 != 0) {
// mem.write_memory(log_addr, (uint8_t *)log_str, sizeof(log_str));
// printf("%d - %s\n", log_addr, log_str);
// } else {
// mem.write_memory(log_addr, (uint8_t *)log_str1,
// sizeof(log_str1)); printf("%d - %s\n", log_addr, log_str1);
// }
}

read_config(NAME, test_config, (uint8_t *)test_config.name,
Expand Down

0 comments on commit e2f2923

Please sign in to comment.