Skip to content

Crash when message is 11 characters #10

@DallasEpperson

Description

@DallasEpperson

If message[] is exactly 11 characters, as in the example sketch, the library does not work. See a shorter example sketch below. This sketch should simply output a single tone, and many lines of "tone change" to the serial monitor. Instead, "tone change" prints once, and the sketch stops.

Changing message[] to some other string that is not 11 characters results in the sketch reaching completion.

#include <si5351.h>
#include <Wire.h>
#include <JTEncode.h>

Si5351 si5351;
JTEncode jtencode;

char message[] = "abababababa";
uint8_t tx_buffer[255];

unsigned long baseFreq;

void encode(){
  uint8_t i;
  memset(tx_buffer, 0, 255);
  jtencode.jt9_encode(message, tx_buffer);

  si5351.output_enable(SI5351_CLK0, 1);

  for(i = 0; i < JT9_SYMBOL_COUNT; i++){
    Serial.println("tone change");
    uint8_t test = tx_buffer[i];
    si5351.set_freq(708080000ULL, SI5351_CLK0);
    delay(580);
  }
  si5351.output_enable(SI5351_CLK0, 0);
}


void setup() {
  Serial.begin(9600);
  baseFreq = 708080000ULL;

  si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
  si5351.set_freq(baseFreq, SI5351_CLK0);
  si5351.output_enable(SI5351_CLK0, 0);
  si5351.update_status();
}

void loop() {
  delay(1000);
  Serial.println("Calling encode();");
  encode();
  Serial.println("Returned from encode();");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions