I'm new to this forum so please correct me if i have formatting issues.
I'm having trouble connecting arduino Uno with the Sparkfun ARGOS Satellite Transceiver Shield. I tried to transmit signals to the Argos, but failed.
I will be very grateful for any suggestions!
ARTIC : Arduino
GND : GND
VUSB : 5V
SCLK : 13 (SCK)
CIPO : 12 (MISO)
COPI : 11 (MOSI)
CS : 10(SS)
G8 : 3
BOOT : 4
INT1 : 5
INT2 : 6
RESETB : 7
PWR_EN : 8
RF_EN : 9
const uint8_t Nx32_bits = 8; // In this example, transmit the maximum amount of data
// The user data. Note: only the least-significant 24 bits of userData[0] are transmitted.
const uint32_t userData[Nx32_bits] = {0x00111213, 0x21222324, 0x31323334, 0x41424344, 0x51525354, 0x61626364, 0x71727374, 0x81828384};
const unsigned long repetitionPeriod = 50000; // Define the repetition period in milliseconds
const uint32_t tcxoWarmupTime = 10; // Define the TCXO warmup time
#include <SPI.h>
#include "SparkFun_ARGOS_ARTIC_R2_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_ARGOS_ARTIC_R2
ARTIC_R2 myARTIC;
// Pin assignments for the SparkFun Thing Plus - Artemis
// (Change these if required)
int CS_Pin = 10;
int GAIN8_Pin = 3; // Optional. Set to -1 if you don't want to control the gain. The library defaults to maximum power.
int BOOT_Pin = 4;
int INT1_Pin = 5;
int INT2_Pin = 6;
int RESET_Pin = 7;
#ifdef IOTA
int IOTA_PWR_EN_Pin = 8; // IOTA has a single power enable pin
#else
int ARTIC_PWR_EN_Pin = 8; // The ARTIC R2 Breakout has separate enables for the ARTIC and the RF Amplifier
int RF_PWR_EN_Pin = 9;
#endif
// Loop Steps - these are used by the switch/case in the main loop
// This structure makes it easy to jump between any of the steps
enum {
configure_ARTIC, // Configure the ARTIC (set the satellite detection timeout and TX mode)
ARTIC_TX, // Start the ARTIC TX
wait_for_ARTIC_TX, // Wait for the ARTIC to transmit
} loop_steps;
int loop_step = configure_ARTIC; // Make sure loop_step is set to configure_ARTIC
// AS3-SP-516-274-CNES specifies a ±10% 'jitter' on the repetition period to reduce the risk of transmission collisions
unsigned long nextTransmitTime; // Time of the next satellite transmission (before jitter is added)
unsigned long nextTransmitTimeActual; // Actual time of the next satellite transmission (including jitter)
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(F("ARGOS ARTIC R2 Example"));
Serial.println();
SPI.begin();
// Uncomment the next line to enable the helpful debug messages
//myARTIC.enableDebugging(); // Enable debug messages to Serial
Serial.println(F("Starting the ARTIC R2..."));
Serial.println();
// Begin the ARTIC: enable power and upload firmware or boot from flash
#ifdef IOTA
if (myARTIC.beginIOTA(CS_Pin, RESET_Pin, BOOT_Pin, IOTA_PWR_EN_Pin, INT1_Pin, INT2_Pin, GAIN8_Pin) == false)
#else
if (myARTIC.begin(CS_Pin, RESET_Pin, BOOT_Pin, ARTIC_PWR_EN_Pin, RF_PWR_EN_Pin, INT1_Pin, INT2_Pin, GAIN8_Pin) == false)
#endif
{
Serial.println("ARTIC R2 not detected. Freezing...");
while (1)
; // Do nothing more
}
// From v1.1.0: we were instructed by Kineis to ensure the Platform ID was written into each module
// and not stored in a configuration file accessible to standard users. To comply with this, SparkFun
// ARTIC R2 boards are now shipped with the Platform ID programmed into PMEM. Customers who have
// earlier versions of the board will need to use version 1.0.9 of the library.
uint32_t platformID = myARTIC.readPlatformID();
if (platformID == 0)
{
Serial.println(F("You appear to have an early version of the SparkFun board."));
Serial.println(F("Please use the Library Manager to select version 1.0.9 of this library."));
Serial.println(F("Freezing..."));
while (1)
; // Do nothing more
}
else
{
Serial.print(F("Your Platform ID is: 0x"));
Serial.println(platformID, HEX);
}
// Define the time of the first transmit
nextTransmitTime = repetitionPeriod;
nextTransmitTimeActual = nextTransmitTime - tcxoWarmupTime; // Start the transmit early to compensate for the TCXO warmup time
}
void loop()
{
// loop is one large switch/case that controls the sequencing of the code
switch (loop_step) {
// ************************************************************************************************
// Configure the ARTIC
case configure_ARTIC:
{
// Set the TCXO voltage to 1.8V and autoDisable to 1
if (myARTIC.setTCXOControl(1.8, true) == false)
{
Serial.println("setTCXOControl failed. Freezing...");
while (1)
; // Do nothing more
}
// Set the TCXO warm-up time
if (myARTIC.setTCXOWarmupTime(tcxoWarmupTime) == false)
{
Serial.println("setTCXOWarmupTime failed. Freezing...");
while (1)
; // Do nothing more
}
// Set the satellite detection timeout to 60 seconds
if (myARTIC.setSatelliteDetectionTimeout(60) == false)
{
Serial.println("setSatelliteDetectionTimeout failed. Freezing...");
while (1)
; // Do nothing more
}
// Set the TX mode to ARGOS 3 PTT-A3
ARTIC_R2_MCU_Command_Result result = myARTIC.sendConfigurationCommand(CONFIG_CMD_SET_PTT_A3_TX_MODE);
myARTIC.printCommandResult(result); // Pretty-print the command result to Serial
if (result != ARTIC_R2_MCU_COMMAND_ACCEPTED)
{
Serial.println("sendConfigurationCommand failed. Freezing...");
while (1)
; // Do nothing more
}
// Read and print the ARGOS configuration
ARGOS_Configuration_Register configuration;
myARTIC.readARGOSconfiguration(&configuration);
myARTIC.printARGOSconfiguration(configuration);
// Set the ARGOS PTT A3 frequency to 401.630 MHz
// From AS3-SP-516-274-CNES:
// The transmitted frequency for PTT/PMT-A3 in the ARGOS 4 system is set between 399.90 MHz to 401.69 MHz
// Due to frequency regulations, the frequency ranges [400.05 MHz to 401.0 MHz] and [401.2 MHz to 401.3 MHz] are forbidden for VLD-A4 transmissions.
if (myARTIC.setARGOS23TxFrequency(401.630) == false)
{
Serial.println("setARGOS23TxFrequency failed. Freezing...");
while (1)
; // Do nothing more
}
// Print the TX frequency
float tx23freq = myARTIC.getARGOS23TxFrequency();
Serial.print(F("The ARGOS 2/3 TX Frequency is "));
Serial.print(tx23freq, 3);
Serial.println(F(" MHz."));
loop_step = ARTIC_TX; // Move on
}
break;
// ************************************************************************************************
// Start the ARTIC in Transmit One Package And Go Idle mode
case ARTIC_TX:
{
// Configure the Tx payload for ARGOS PTT A3 using the platform ID and the defined user data
// From v1.1.0 of the library, the platform ID is stored in PMEM and, for this example, should be 0x01234567
if (myARTIC.setPayloadARGOS3(Nx32_bits, (uint32_t *)&userData) == false)
{
Serial.println(F("setPayloadARGOS3 failed!"));
Serial.println();
// Read the payload back again and print it
myARTIC.readTxPayload();
myARTIC.printTxPayload();
Serial.println();
Serial.println(F("Freezing..."));
while (1)
; // Do nothing more
}
/*
// Read the payload back again and print it
myARTIC.readTxPayload();
myARTIC.printTxPayload();
Serial.println();
*/
// Wait for the next repetition period
while (nextTransmitTimeActual > millis())
{
if ((millis() % 1000) < 50) // Print how long it is until the next transmit
{
Serial.print(F("The next transmit will take place in "));
unsigned long remaining = (nextTransmitTimeActual - millis()) / 1000;
Serial.print(remaining);
Serial.println(F(" seconds"));
}
delay(50);
}
nextTransmitTime += repetitionPeriod;
nextTransmitTimeActual = nextTransmitTime + random((-0.1 * repetitionPeriod), (0.1 * repetitionPeriod));
nextTransmitTimeActual -= tcxoWarmupTime; // Start the transmit early to compensate for the TCXO warmup time
// Tell the ARTIC to do its thing!
ARTIC_R2_MCU_Command_Result result = myARTIC.sendMCUinstruction(INST_TRANSMIT_ONE_PACKAGE_AND_GO_IDLE);
if (result != ARTIC_R2_MCU_COMMAND_ACCEPTED)
{
Serial.println("sendMCUinstruction(INST_TRANSMIT_ONE_PACKAGE_AND_GO_IDLE) failed!");
Serial.println();
ARTIC_R2_Firmware_Status status;
myARTIC.readStatusRegister(&status); // Read the ARTIC R2 status register
Serial.println(F("ARTIC R2 Firmware Status:"));
myARTIC.printFirmwareStatus(status); // Pretty-print the firmware status to Serial
Serial.println();
Serial.println(F("ARTIC_R2_MCU_Command_Result:"));
myARTIC.printCommandResult(result); // Pretty-print the command result to Serial
Serial.println();
Serial.println("Freezing...");
while (1)
; // Do nothing more
}
loop_step = wait_for_ARTIC_TX; // Move on
}
break;
// ************************************************************************************************
// Start the ARTIC in Transmit One Package And Go Idle mode
case wait_for_ARTIC_TX:
{
delay(1000); // Check the status every second
// Read and print the ARTIC R2 status register
ARTIC_R2_Firmware_Status status;
myARTIC.readStatusRegister(&status); // Read the ARTIC R2 status register
Serial.println(F("ARTIC R2 Firmware Status:"));
myARTIC.printFirmwareStatus(status); // Pretty-print the firmware status to Serial
if (status.STATUS_REGISTER_BITS.DSP2MCU_INT1) // Check the interrupt 1 flag. This will go high when TX is finished
{
Serial.println(F("INT1 pin is high. TX is finished (or MCU is in IDLE_STATE)!"));
}
if (status.STATUS_REGISTER_BITS.DSP2MCU_INT2) // Check the interrupt 2 flag. This will go high when if the message was invalid
{
Serial.println(F("INT2 pin is high. TX message was invalid! (Something really bad must have happened...)"));
}
Serial.println();
// Read and print the instruction progress
ARTIC_R2_MCU_Instruction_Progress progress;
// checkMCUinstructionProgress will return true if the instruction is complete
boolean instructionComplete = myARTIC.checkMCUinstructionProgress(&progress); // Check the instruction progress
Serial.println(F("ARTIC R2 instruction progress:"));
myARTIC.printInstructionProgress(progress); // Pretty-print the progress to Serial
Serial.println();
if (instructionComplete)
{
Serial.println(F("Transmission is complete!"));
Serial.println();
Serial.println(F("Clearing INT1."));
Serial.println();
// Clear INT1
if (myARTIC.clearInterrupts(1) == false)
{
Serial.println("clearInterrupts failed! Freezing...");
while (1)
; // Do nothing more
}
loop_step = ARTIC_TX; // Do over...
}
}
break;
}
}