Example #1
0
// Config reset ----------------------------------------------------------
void RadioSi446x::reset(void) 
{
  digitalWrite(VCXO_ENABLE_PIN,HIGH);
//  Serial.println("VCXO is enabled"); 
  delay(200);
  
  

  digitalWrite(RADIO_SDN_PIN, HIGH);  // active high shutdown = reset
  delay(200);
  digitalWrite(RADIO_SDN_PIN, LOW);   // booting
//  Serial.println("Radio is powered up"); 

  // Start talking to the Si446X radio chip

  const char PART_INFO_command[] = {0x01}; // Part Info
  SendCmdReceiveAnswer(1, 9, PART_INFO_command);
//  Serial.println("Part info was checked");

//divide VCXO_FREQ into its bytes; MSB first  
  unsigned int x3 = VCXO_FREQ / 0x1000000;
  unsigned int x2 = (VCXO_FREQ - x3 * 0x1000000) / 0x10000;
  unsigned int x1 = (VCXO_FREQ - x3 * 0x1000000 - x2 * 0x10000) / 0x100;
  unsigned int x0 = (VCXO_FREQ - x3 * 0x1000000 - x2 * 0x10000 - x1 * 0x100); 

//POWER_UP
  const char init_command[] = {0x02, 0x01, 0x01, x3, x2, x1, x0};// no patch, boot main app. img, FREQ_VCXO, return 1 byte
  SendCmdReceiveAnswer(7, 1 ,init_command); 

//  Serial.println("Radio booted"); 

  const char get_int_status_command[] = {0x20, 0x00, 0x00, 0x00}; //  Clear all pending interrupts and get the interrupt status back
  SendCmdReceiveAnswer(4, 9, get_int_status_command);


//  Serial.println("Radio ready");
 
  const char gpio_pin_cfg_command[] = {0x13, 0x02, 0x02, 0x02, 0x02, 0x08, 0x11, 0x00}; //  Set all GPIOs LOW; Link NIRQ to CTS; Link SDO to MISO; Max drive strength
  SendCmdReceiveAnswer(8, 8, gpio_pin_cfg_command);

//  Serial.println("LEDs should be switched off at this point");
  
  setFrequency(active_freq);
//  Serial.println("Frequency set");  
 
  setModem(); 
//  Serial.println("CW mode set");  
  
  tune_tx();
//  Serial.println("TX tune");  



}
Example #2
0
// Config reset ----------------------------------------------------------
void RadioSi446x::reset(void) 
{
  digitalWrite(VCXO_ENABLE_PIN,HIGH);
//  Serial.println("VCXO is enabled"); 
  delay(200);
  
  

  digitalWrite(RADIO_SDN_PIN, HIGH);  // active high shutdown = reset
  delay(200);
  digitalWrite(RADIO_SDN_PIN, LOW);   // booting
//  Serial.println("Radio is powered up"); 

  // Start talking to the Si446X radio chip

  const char PART_INFO_command[] = {0x01}; // Part Info
  SendCmdReceiveAnswer(1, 9, PART_INFO_command);
//  Serial.println("Part info was checked");

//W2CXM - Suggested that we add this delay by aadmson
  delay(15);

//divide VCXO_FREQ into its bytes; MSB first  
  unsigned int x3 = VCXO_FREQ / 0x1000000;
  unsigned int x2 = (VCXO_FREQ - x3 * 0x1000000) / 0x10000;
  unsigned int x1 = (VCXO_FREQ - x3 * 0x1000000 - x2 * 0x10000) / 0x100;
  unsigned int x0 = (VCXO_FREQ - x3 * 0x1000000 - x2 * 0x10000 - x1 * 0x100); 

//POWER_UP
  const char init_command[] = {0x02, 0x01, 0x01, x3, x2, x1, x0};// no patch, boot main app. img, FREQ_VCXO, return 1 byte
  SendCmdReceiveAnswer(7, 1 ,init_command); 

//  Serial.println("Radio booted"); 

  const char get_int_status_command[] = {0x20, 0x00, 0x00, 0x00}; //  Clear all pending interrupts and get the interrupt status back
  SendCmdReceiveAnswer(4, 9, get_int_status_command);


//  Serial.println("Radio ready");
 
  const char gpio_pin_cfg_command[] = {0x13, 0x02, 0x02, 0x02, 0x02, 0x08, 0x0b, 0x00}; //  Set all GPIOs LOW; Link NIRQ to CTS; Link SDO to MISO; Max drive strength
  SendCmdReceiveAnswer(8, 8, gpio_pin_cfg_command);

// W2CXM - Added two more initializations per aadamson
  const char set_global_config1[] = {0x11, 0x00, 0x01, 0x03, 0x60};
  SendCmdReceiveAnswer(5, 1, set_global_config1);
  // cliPrint("Setting special global Config 1 changes (see WDS)\n");

  const char set_global_xo_tune_command[] = {0x11, 0x00, 0x01, 0x00, 0x00};
  SendCmdReceiveAnswer(5, 1, set_global_xo_tune_command);
  // cliPrint("Setting no additional capacitance on VXCO\n");
// W2CXM ^^^^^^^^^

//  Serial.println("LEDs should be switched off at this point");
  
  setFrequency(active_freq);
//  Serial.println("Frequency set");  
 
  setModem(); 
//  Serial.println("CW mode set");  
  
  tune_tx();
//  Serial.println("TX tune");  



}