commit
cdc6c5a9e2
@ -1,37 +1,149 @@
|
|||||||
# CubeSatSim
|
# CubeSatSim
|
||||||
|
|
||||||
The CubeSat Simulator https://github.com/alanbjohnston/CubeSatSim/wiki is a low cost satellite emulator that run on solar panels and batteries, transmits UHF radio telemetry, has a 3D printed frame, and can be extended by additional sensors and modules. This project is sponsored by the not-for-profit [Radio Amateur Satellite Corporation, AMSAT®](https://amsat.org).
|
The CubeSat Simulator https://github.com/alanbjohnston/CubeSatSim/wiki is a low cost satellite emulator that runs on solar panels and batteries, transmits UHF radio telemetry, has a 3D printed frame, and can be extended by additional sensors and modules. This project is sponsored by the not-for-profit [Radio Amateur Satellite Corporation, AMSAT®](https://amsat.org).
|
||||||
|
|
||||||
See the Wiki Software Install page for more details: https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install. To build and run the software on a Raspberry Pi 3B, 3B+, or Pi Zero W:
|
There are several hardware versions and software branches to go with them - see below for information.
|
||||||
|
|
||||||
|
See the Wiki Software Install page for more details: https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install. To build and run the software on a Raspberry Pi 3B, 3B+, or Pi Zero W (doesn't work on Pi 4 since rpitx doesn't work on it yet):
|
||||||
|
Requires:
|
||||||
|
- Raspbian Stretch or Buster, full desktop or Lite
|
||||||
|
- wiringpi
|
||||||
|
- git
|
||||||
|
- libasound2-dev
|
||||||
|
- pi-power-button
|
||||||
|
- Direwolf
|
||||||
|
- rpitx
|
||||||
|
|
||||||
|
See the Wiki Software Install page for more details: https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install. To build and run the software on a Raspberry Pi 3B, 3B+, or Pi Zero W (Does NOT work on a Pi 4 since rpitx does not work on it yet):
|
||||||
|
|
||||||
|
`sudo apt-get install -y wiringpi git libasound2-dev i2c-tools`
|
||||||
|
|
||||||
|
Run raspi-config and enable the I2C bus by selecting Option 5 Interfacing Options and then Option 5 I2C and selecting Y to enable the ARM I2C bus:
|
||||||
|
|
||||||
|
`sudo raspi-config`
|
||||||
|
|
||||||
|
Select Finish at the bottom to exit raspi-config. Then type:
|
||||||
|
|
||||||
|
`sudo cp /boot/config.txt /boot/config.txt.0`
|
||||||
|
|
||||||
|
`sudo nano /boot/config.txt`
|
||||||
|
|
||||||
|
Use the down arrow key to go down in the file until you find this line:
|
||||||
|
|
||||||
|
`# Additional overlays and parameters are documented /boot/overlays/README `
|
||||||
|
|
||||||
|
Add the following two lines under it:
|
||||||
|
|
||||||
|
`dtoverlay=i2c-gpio`
|
||||||
|
|
||||||
|
`dtoverlay=pi3-miniuart-bt`
|
||||||
|
|
||||||
|
Press Ctrl-X then type `y` then hit Enter to save the file and exit the editor. You should back at the pi@... prompt.
|
||||||
|
|
||||||
|
Edit the cmdline.txt file by typing:
|
||||||
|
|
||||||
|
`sudo cp /boot/cmdline.txt /boot/cmdline.txt.0`
|
||||||
|
|
||||||
|
`sudo nano /boot/cmdline.txt`
|
||||||
|
|
||||||
|
Remove the following text in cmdline.txt to prevent a console from running on the serial port:
|
||||||
|
|
||||||
|
`console=serial0,115200`
|
||||||
|
|
||||||
|
Press Ctrl-X then type `y` then hit Enter to save the file and exit the editor. You should back at the pi@... prompt.
|
||||||
|
|
||||||
|
Reboot by typing:
|
||||||
|
|
||||||
|
`sudo reboot now`
|
||||||
|
|
||||||
|
after logging back into the Pi, type:
|
||||||
|
|
||||||
|
`ls -a /dev/i2c*`
|
||||||
|
|
||||||
|
you should see two I2C buses:
|
||||||
|
|
||||||
|
`i2c-1 i2c-3`
|
||||||
|
|
||||||
|
Continue the install by typing:
|
||||||
|
|
||||||
|
`cd`
|
||||||
|
|
||||||
|
Then type:
|
||||||
|
|
||||||
`git clone http://github.com/alanbjohnston/CubeSatSim.git`
|
`git clone http://github.com/alanbjohnston/CubeSatSim.git`
|
||||||
|
|
||||||
`cd CubeSatSim`
|
`cd CubeSatSim`
|
||||||
|
|
||||||
Edit the afsk/main.c file to set your amateur radio callsign, then
|
`git checkout universal`
|
||||||
|
|
||||||
|
Create a sim.cfg configuration file with your amateur radio callsign by typing:
|
||||||
|
|
||||||
|
`echo "callsign" >> sim.cfg`
|
||||||
|
|
||||||
|
Compile the code:
|
||||||
|
|
||||||
`make rebuild`
|
`make rebuild`
|
||||||
|
|
||||||
To hear CW telemetry (Morse code), tune your radio or SDR to 435.297 MHz and enter:
|
`cd`
|
||||||
|
|
||||||
|
`git clone https://www.github.com/wb2osz/direwolf`
|
||||||
|
|
||||||
|
`cd direwolf`
|
||||||
|
|
||||||
|
`make -j`
|
||||||
|
|
||||||
|
(takes a while)
|
||||||
|
|
||||||
|
`sudo make install`
|
||||||
|
|
||||||
|
`make install-rpi`
|
||||||
|
|
||||||
|
Note that this last command may fail if you are using Raspbian Lite since there is no Desktop (you may get an error such as this "ln: failed to create symbolic link '/home/pi/Desktop/direwolf.desktop': No such file or directory
|
||||||
|
make: *** [Makefile.linux:727: install-rpi] Error 1"
|
||||||
|
|
||||||
|
`cd`
|
||||||
|
|
||||||
|
`git clone https://github.com/F5OEO/rpitx.git`
|
||||||
|
|
||||||
|
`cd rpitx`
|
||||||
|
|
||||||
`./radiocw`
|
`./install.sh`
|
||||||
|
|
||||||
To stop, Ctrl-C. To hear AFSK telemetry (X.25 data), your radio or SDR to 440.389 MHz FM, and you should receive telemetry from the CubeSat Sim:
|
(Takes a while). It will prompt you if you want to modify /boot/config.txt file. Type a `y` and the script will complete.
|
||||||
|
|
||||||
`./radioafsk`
|
`cd`
|
||||||
|
|
||||||
This code uses the Brandenburg Tech Digital Transceiver, based on DigitalTxRxRP https://brandenburgtech.wordpress.com/
|
`git clone https://github.com/alanbjohnston/pi-power-button.git`
|
||||||
|
|
||||||
This repository contains:
|
`cd pi-power-button`
|
||||||
|
|
||||||
- afsk - Code that sends telemetry in 1k2 AFSK X.25 format
|
`./script/install`
|
||||||
- arduino - Sample Arduino sketches to show how payload sensors can be interfaced to CubeSat Simulator
|
|
||||||
- ax5043 - Source for a library of functions to communicate with the AX5043 and configure the AX5043.
|
To make the demo.sh script run automatically on boot:
|
||||||
- cw - Code that sends telemetry in CW (Morse code) using AO-7 format
|
|
||||||
- libs - External libraries
|
`sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service`
|
||||||
- python - Python code for reading I2C sensors for current and temperature
|
|
||||||
- spreadsheet - Spreadsheets for decoding and analyzing the Simulator telemetry (see https://github.com/alanbjohnston/CubeSatSim/wiki/Decoding-Telemetry for details)
|
`sudo systemctl enable cubesatsim`
|
||||||
- wav - Wave audio files of CW or AFSK telemetry for listening or transmitting usng a CubeSat Simulator Lite
|
|
||||||
- demo.sh - a shell script to run the Simulator on boot using systemd (see https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install#autoboot-configuration for how to configure the Pi)
|
Now reboot for all the changes to take effect:
|
||||||
|
|
||||||
|
`sudo reboot now`
|
||||||
|
|
||||||
|
After rebooting, tune your radio or SDR to 434.9 MHz FM, and you should receive telemetry from the CubeSatSim!
|
||||||
|
|
||||||
|
You can stop the service:
|
||||||
|
|
||||||
|
`sudo systemctl stop cubesatsim`
|
||||||
|
|
||||||
|
After rebooting, it will start unless you disable it:
|
||||||
|
|
||||||
|
`sudo systemctl disable cubesatsim`
|
||||||
|
|
||||||
See the Wiki for more details https://github.com/alanbjohnston/CubeSatSim/wiki
|
See the Wiki for more details https://github.com/alanbjohnston/CubeSatSim/wiki
|
||||||
|
|
||||||
|
Older Versions
|
||||||
|
|
||||||
|
There are several versions of the hardware and software to go with them:
|
||||||
|
|
||||||
|
- The original design used a Digital Transceiver Board for the Raspberry Pi (DigitalTxRxRPi) and APRS AFSK 1200 bps telemetry only. Use the aprs-digitaltxrx branch for this and the vB2 wiki page https://github.com/alanbjohnston/CubeSatSim/wiki/vB2-Home
|
||||||
|
- An updated design that used the Transmitter/Filter Board (TFB) instead of the the Transceiver Board. For the same APRS AFSK telemetry, use the aprs-rpitx branch and the vB3 wiki page https://github.com/alanbjohnston/CubeSatSim/wiki/vB3-Home. Note that this hardware can still use the master code branch.
|
||||||
|
|||||||
@ -0,0 +1,154 @@
|
|||||||
|
/*!
|
||||||
|
* @file Adafruit_INA219.h
|
||||||
|
*
|
||||||
|
* This is a library for the Adafruit INA219 breakout board
|
||||||
|
* ----> https://www.adafruit.com/products/904
|
||||||
|
*
|
||||||
|
* Adafruit invests time and resources providing this open source code,
|
||||||
|
* please support Adafruit and open-source hardware by purchasing
|
||||||
|
* products from Adafruit!
|
||||||
|
*
|
||||||
|
* Written by Kevin "KTOWN" Townsend for Adafruit Industries.
|
||||||
|
*
|
||||||
|
* BSD license, all text here must be included in any redistribution.
|
||||||
|
*
|
||||||
|
* Converted to C for Raspberry Pi by Alan Johnston KU2Y
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <wiringPi.h>
|
||||||
|
|
||||||
|
/** default I2C address **/
|
||||||
|
#define INA219_ADDRESS (0x40) // 1000000 (A0+A1=GND)
|
||||||
|
|
||||||
|
/** read **/
|
||||||
|
#define INA219_READ (0x01)
|
||||||
|
|
||||||
|
/*=========================================================================
|
||||||
|
CONFIG REGISTER (R/W)
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/** config register address **/
|
||||||
|
#define INA219_REG_CONFIG (0x00)
|
||||||
|
|
||||||
|
/** reset bit **/
|
||||||
|
#define INA219_CONFIG_RESET (0x8000) // Reset Bit
|
||||||
|
|
||||||
|
/** mask for bus voltage range **/
|
||||||
|
#define INA219_CONFIG_BVOLTAGERANGE_MASK (0x2000) // Bus Voltage Range Mask
|
||||||
|
|
||||||
|
/** bus voltage range values **/
|
||||||
|
enum {
|
||||||
|
INA219_CONFIG_BVOLTAGERANGE_16V = (0x0000), // 0-16V Range
|
||||||
|
INA219_CONFIG_BVOLTAGERANGE_32V = (0x2000), // 0-32V Range
|
||||||
|
};
|
||||||
|
|
||||||
|
/** mask for gain bits **/
|
||||||
|
#define INA219_CONFIG_GAIN_MASK (0x1800) // Gain Mask
|
||||||
|
|
||||||
|
/** values for gain bits **/
|
||||||
|
enum {
|
||||||
|
INA219_CONFIG_GAIN_1_40MV = (0x0000), // Gain 1, 40mV Range
|
||||||
|
INA219_CONFIG_GAIN_2_80MV = (0x0800), // Gain 2, 80mV Range
|
||||||
|
INA219_CONFIG_GAIN_4_160MV = (0x1000), // Gain 4, 160mV Range
|
||||||
|
INA219_CONFIG_GAIN_8_320MV = (0x1800), // Gain 8, 320mV Range
|
||||||
|
};
|
||||||
|
|
||||||
|
/** mask for bus ADC resolution bits **/
|
||||||
|
#define INA219_CONFIG_BADCRES_MASK (0x0780)
|
||||||
|
|
||||||
|
/** values for bus ADC resolution **/
|
||||||
|
enum {
|
||||||
|
INA219_CONFIG_BADCRES_9BIT = (0x0000), // 9-bit bus res = 0..511
|
||||||
|
INA219_CONFIG_BADCRES_10BIT = (0x0080), // 10-bit bus res = 0..1023
|
||||||
|
INA219_CONFIG_BADCRES_11BIT = (0x0100), // 11-bit bus res = 0..2047
|
||||||
|
INA219_CONFIG_BADCRES_12BIT = (0x0180), // 12-bit bus res = 0..4097
|
||||||
|
};
|
||||||
|
|
||||||
|
/** mask for shunt ADC resolution bits **/
|
||||||
|
#define INA219_CONFIG_SADCRES_MASK \
|
||||||
|
(0x0078) // Shunt ADC Resolution and Averaging Mask
|
||||||
|
|
||||||
|
/** values for shunt ADC resolution **/
|
||||||
|
enum {
|
||||||
|
INA219_CONFIG_SADCRES_9BIT_1S_84US = (0x0000), // 1 x 9-bit shunt sample
|
||||||
|
INA219_CONFIG_SADCRES_10BIT_1S_148US = (0x0008), // 1 x 10-bit shunt sample
|
||||||
|
INA219_CONFIG_SADCRES_11BIT_1S_276US = (0x0010), // 1 x 11-bit shunt sample
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_1S_532US = (0x0018), // 1 x 12-bit shunt sample
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_2S_1060US =
|
||||||
|
(0x0048), // 2 x 12-bit shunt samples averaged together
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_4S_2130US =
|
||||||
|
(0x0050), // 4 x 12-bit shunt samples averaged together
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_8S_4260US =
|
||||||
|
(0x0058), // 8 x 12-bit shunt samples averaged together
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_16S_8510US =
|
||||||
|
(0x0060), // 16 x 12-bit shunt samples averaged together
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_32S_17MS =
|
||||||
|
(0x0068), // 32 x 12-bit shunt samples averaged together
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_64S_34MS =
|
||||||
|
(0x0070), // 64 x 12-bit shunt samples averaged together
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_128S_69MS =
|
||||||
|
(0x0078), // 128 x 12-bit shunt samples averaged together
|
||||||
|
};
|
||||||
|
|
||||||
|
/** mask for operating mode bits **/
|
||||||
|
#define INA219_CONFIG_MODE_MASK (0x0007) // Operating Mode Mask
|
||||||
|
|
||||||
|
/** values for operating mode **/
|
||||||
|
enum {
|
||||||
|
INA219_CONFIG_MODE_POWERDOWN,
|
||||||
|
INA219_CONFIG_MODE_SVOLT_TRIGGERED,
|
||||||
|
INA219_CONFIG_MODE_BVOLT_TRIGGERED,
|
||||||
|
INA219_CONFIG_MODE_SANDBVOLT_TRIGGERED,
|
||||||
|
INA219_CONFIG_MODE_ADCOFF,
|
||||||
|
INA219_CONFIG_MODE_SVOLT_CONTINUOUS,
|
||||||
|
INA219_CONFIG_MODE_BVOLT_CONTINUOUS,
|
||||||
|
INA219_CONFIG_MODE_SANDBVOLT_CONTINUOUS
|
||||||
|
};
|
||||||
|
|
||||||
|
/** shunt voltage register **/
|
||||||
|
#define INA219_REG_SHUNTVOLTAGE (0x01)
|
||||||
|
|
||||||
|
/** bus voltage register **/
|
||||||
|
#define INA219_REG_BUSVOLTAGE (0x02)
|
||||||
|
|
||||||
|
/** power register **/
|
||||||
|
#define INA219_REG_POWER (0x03)
|
||||||
|
|
||||||
|
/** current register **/
|
||||||
|
#define INA219_REG_CURRENT (0x04)
|
||||||
|
|
||||||
|
/** calibration register **/
|
||||||
|
#define INA219_REG_CALIBRATION (0x05)
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* functions for interacting with INA219
|
||||||
|
* current/power monitor IC
|
||||||
|
*/
|
||||||
|
//void begin(TwoWire *theWire = &Wire);
|
||||||
|
void setCalibration_32V_2A(int fd);
|
||||||
|
void setCalibration_32V_1A(int fd);
|
||||||
|
void setCalibration_16V_400mA(int fd);
|
||||||
|
void setCalibration_16V_2A(int fd);
|
||||||
|
float getBusVoltage_V(int fd);
|
||||||
|
float getShuntVoltage_mV(int fd);
|
||||||
|
float getCurrent_mA(int fd);
|
||||||
|
float getPower_mW(int fd);
|
||||||
|
void powerSave(int fd, int on);
|
||||||
|
|
||||||
|
uint8_t ina219_i2caddr;
|
||||||
|
//uint32_t ina219_calValue;
|
||||||
|
uint16_t ina219_calValue;
|
||||||
|
uint16_t ina219_config;
|
||||||
|
// The following multipliers are used to convert raw current and power
|
||||||
|
// values to mA and mW, taking into account the current config settings
|
||||||
|
uint32_t ina219_currentDivider_mA;
|
||||||
|
float ina219_powerMultiplier_mW;
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void wireWriteRegister(int fd, uint8_t reg, uint16_t value);
|
||||||
|
uint16_t wireReadRegister(int fd, uint8_t reg);
|
||||||
|
int16_t getBusVoltage_raw(int fd);
|
||||||
|
int16_t getShuntVoltage_raw(int fd);
|
||||||
|
int16_t getCurrent_raw(int fd);
|
||||||
|
int16_t getPower_raw(int fd);
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
* A sample application transmitting AFSK at 1200 baud
|
|
||||||
*
|
|
||||||
* Portions Copyright (C) 2018 Jonathan Brandenburg
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "status.h"
|
|
||||||
#include "ax5043.h"
|
|
||||||
#include "ax25.h"
|
|
||||||
#include "spi/ax5043spi.h"
|
|
||||||
|
|
||||||
ax5043_conf_t hax5043;
|
|
||||||
ax25_conf_t hax25;
|
|
||||||
|
|
||||||
static void init_rf();
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
setSpiChannel(SPI_CHANNEL);
|
|
||||||
setSpiSpeed(SPI_SPEED);
|
|
||||||
initializeSpi();
|
|
||||||
|
|
||||||
init_rf();
|
|
||||||
|
|
||||||
ax25_init(&hax25, (uint8_t *) "CQ", '2', (uint8_t *) "DX", '2',
|
|
||||||
AX25_PREAMBLE_LEN,
|
|
||||||
AX25_POSTAMBLE_LEN);
|
|
||||||
|
|
||||||
int ret;
|
|
||||||
uint8_t data[1024];
|
|
||||||
// 0x03 is a UI frame
|
|
||||||
// 0x0F is no Level 3 protocol
|
|
||||||
const char *str = "\x03\x0fThis is an AX.25 Packet from CubeSatSim!!!";
|
|
||||||
|
|
||||||
/* Infinite loop */
|
|
||||||
for (;;) {
|
|
||||||
sleep(2);
|
|
||||||
printf("INFO: Transmitting a packet\n");
|
|
||||||
|
|
||||||
memcpy(data, str, strnlen(str, 256));
|
|
||||||
ret = ax25_tx_frame(&hax25, &hax5043, data, strnlen(str, 256));
|
|
||||||
if (ret) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"ERROR: Failed to transmit AX.25 frame with error code %d\n",
|
|
||||||
ret);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
ax5043_wait_for_transmit();
|
|
||||||
if (ret) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"ERROR: Failed to transmit entire AX.25 frame with error code %d\n",
|
|
||||||
ret);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_rf() {
|
|
||||||
int ret;
|
|
||||||
ret = ax5043_init(&hax5043, XTAL_FREQ_HZ, VCO_INTERNAL);
|
|
||||||
if (ret != PQWS_SUCCESS) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"ERROR: Failed to initialize AX5043 with error code %d\n", ret);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,562 @@
|
|||||||
|
/* make_wav.h
|
||||||
|
* Fri Jun 18 17:06:02 PDT 2010 Kevin Karplus
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MAKE_WAV_H
|
||||||
|
#define MAKE_WAV_H
|
||||||
|
|
||||||
|
void write_wav(char * filename, unsigned long num_samples, short int * data, int s_rate);
|
||||||
|
/* open a file named filename, write signed 16-bit values as a
|
||||||
|
monoaural WAV file at the specified sampling rate
|
||||||
|
and close the file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TelemEncoding.h
|
||||||
|
*
|
||||||
|
* Created on: Feb 3, 2014
|
||||||
|
* Author: fox
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TELEMENCODING_H_
|
||||||
|
#define TELEMENCODING_H_
|
||||||
|
|
||||||
|
void update_rs(
|
||||||
|
unsigned char parity[32], // 32-byte encoder state; zero before each frame
|
||||||
|
unsigned char c // Current data byte to update
|
||||||
|
);
|
||||||
|
|
||||||
|
#define CHARACTER_BITS 10
|
||||||
|
#define CHARACTERS_PER_LONGWORD 3
|
||||||
|
#define CHARACTER_MASK ((1<<CHARACTER_BITS)-1)
|
||||||
|
#define SYNC_CHARACTER -1
|
||||||
|
|
||||||
|
|
||||||
|
#define PARITY_BYTES_PER_CODEWORD 32U // Number of parity symbols in frame
|
||||||
|
#define NP 32U //For Phil's code
|
||||||
|
#define DATA_BYTES_PER_CODE_WORD 223
|
||||||
|
|
||||||
|
#endif /* TELEMENCODING_H_ */
|
||||||
|
|
||||||
|
int Encode_8b10b[][256] = {
|
||||||
|
// RD = -1 cases
|
||||||
|
{
|
||||||
|
/* 00 */ 0x274,
|
||||||
|
/* 01 */ 0x1d4,
|
||||||
|
/* 02 */ 0x2d4,
|
||||||
|
/* 03 */ 0x71b,
|
||||||
|
/* 04 */ 0x354,
|
||||||
|
/* 05 */ 0x69b,
|
||||||
|
/* 06 */ 0x59b,
|
||||||
|
/* 07 */ 0x78b,
|
||||||
|
/* 08 */ 0x394,
|
||||||
|
/* 09 */ 0x65b,
|
||||||
|
/* 0a */ 0x55b,
|
||||||
|
/* 0b */ 0x74b,
|
||||||
|
/* 0c */ 0x4db,
|
||||||
|
/* 0d */ 0x6cb,
|
||||||
|
/* 0e */ 0x5cb,
|
||||||
|
/* 0f */ 0x174,
|
||||||
|
/* 10 */ 0x1b4,
|
||||||
|
/* 11 */ 0x63b,
|
||||||
|
/* 12 */ 0x53b,
|
||||||
|
/* 13 */ 0x72b,
|
||||||
|
/* 14 */ 0x4bb,
|
||||||
|
/* 15 */ 0x6ab,
|
||||||
|
/* 16 */ 0x5ab,
|
||||||
|
/* 17 */ 0x3a4,
|
||||||
|
/* 18 */ 0x334,
|
||||||
|
/* 19 */ 0x66b,
|
||||||
|
/* 1a */ 0x56b,
|
||||||
|
/* 1b */ 0x364,
|
||||||
|
/* 1c */ 0x4eb,
|
||||||
|
/* 1d */ 0x2e4,
|
||||||
|
/* 1e */ 0x1e4,
|
||||||
|
/* 1f */ 0x2b4,
|
||||||
|
/* 20 */ 0x679,
|
||||||
|
/* 21 */ 0x5d9,
|
||||||
|
/* 22 */ 0x6d9,
|
||||||
|
/* 23 */ 0x319,
|
||||||
|
/* 24 */ 0x759,
|
||||||
|
/* 25 */ 0x299,
|
||||||
|
/* 26 */ 0x199,
|
||||||
|
/* 27 */ 0x389,
|
||||||
|
/* 28 */ 0x799,
|
||||||
|
/* 29 */ 0x259,
|
||||||
|
/* 2a */ 0x159,
|
||||||
|
/* 2b */ 0x349,
|
||||||
|
/* 2c */ 0x0d9,
|
||||||
|
/* 2d */ 0x2c9,
|
||||||
|
/* 2e */ 0x1c9,
|
||||||
|
/* 2f */ 0x579,
|
||||||
|
/* 30 */ 0x5b9,
|
||||||
|
/* 31 */ 0x239,
|
||||||
|
/* 32 */ 0x139,
|
||||||
|
/* 33 */ 0x329,
|
||||||
|
/* 34 */ 0x0b9,
|
||||||
|
/* 35 */ 0x2a9,
|
||||||
|
/* 36 */ 0x1a9,
|
||||||
|
/* 37 */ 0x7a9,
|
||||||
|
/* 38 */ 0x739,
|
||||||
|
/* 39 */ 0x269,
|
||||||
|
/* 3a */ 0x169,
|
||||||
|
/* 3b */ 0x769,
|
||||||
|
/* 3c */ 0x0e9,
|
||||||
|
/* 3d */ 0x6e9,
|
||||||
|
/* 3e */ 0x5e9,
|
||||||
|
/* 3f */ 0x6b9,
|
||||||
|
/* 40 */ 0x675,
|
||||||
|
/* 41 */ 0x5d5,
|
||||||
|
/* 42 */ 0x6d5,
|
||||||
|
/* 43 */ 0x315,
|
||||||
|
/* 44 */ 0x755,
|
||||||
|
/* 45 */ 0x295,
|
||||||
|
/* 46 */ 0x195,
|
||||||
|
/* 47 */ 0x385,
|
||||||
|
/* 48 */ 0x795,
|
||||||
|
/* 49 */ 0x255,
|
||||||
|
/* 4a */ 0x155,
|
||||||
|
/* 4b */ 0x345,
|
||||||
|
/* 4c */ 0x0d5,
|
||||||
|
/* 4d */ 0x2c5,
|
||||||
|
/* 4e */ 0x1c5,
|
||||||
|
/* 4f */ 0x575,
|
||||||
|
/* 50 */ 0x5b5,
|
||||||
|
/* 51 */ 0x235,
|
||||||
|
/* 52 */ 0x135,
|
||||||
|
/* 53 */ 0x325,
|
||||||
|
/* 54 */ 0x0b5,
|
||||||
|
/* 55 */ 0x2a5,
|
||||||
|
/* 56 */ 0x1a5,
|
||||||
|
/* 57 */ 0x7a5,
|
||||||
|
/* 58 */ 0x735,
|
||||||
|
/* 59 */ 0x265,
|
||||||
|
/* 5a */ 0x165,
|
||||||
|
/* 5b */ 0x765,
|
||||||
|
/* 5c */ 0x0e5,
|
||||||
|
/* 5d */ 0x6e5,
|
||||||
|
/* 5e */ 0x5e5,
|
||||||
|
/* 5f */ 0x6b5,
|
||||||
|
/* 60 */ 0x673,
|
||||||
|
/* 61 */ 0x5d3,
|
||||||
|
/* 62 */ 0x6d3,
|
||||||
|
/* 63 */ 0x31c,
|
||||||
|
/* 64 */ 0x753,
|
||||||
|
/* 65 */ 0x29c,
|
||||||
|
/* 66 */ 0x19c,
|
||||||
|
/* 67 */ 0x38c,
|
||||||
|
/* 68 */ 0x793,
|
||||||
|
/* 69 */ 0x25c,
|
||||||
|
/* 6a */ 0x15c,
|
||||||
|
/* 6b */ 0x34c,
|
||||||
|
/* 6c */ 0x0dc,
|
||||||
|
/* 6d */ 0x2cc,
|
||||||
|
/* 6e */ 0x1cc,
|
||||||
|
/* 6f */ 0x573,
|
||||||
|
/* 70 */ 0x5b3,
|
||||||
|
/* 71 */ 0x23c,
|
||||||
|
/* 72 */ 0x13c,
|
||||||
|
/* 73 */ 0x32c,
|
||||||
|
/* 74 */ 0x0bc,
|
||||||
|
/* 75 */ 0x2ac,
|
||||||
|
/* 76 */ 0x1ac,
|
||||||
|
/* 77 */ 0x7a3,
|
||||||
|
/* 78 */ 0x733,
|
||||||
|
/* 79 */ 0x26c,
|
||||||
|
/* 7a */ 0x16c,
|
||||||
|
/* 7b */ 0x763,
|
||||||
|
/* 7c */ 0x0ec,
|
||||||
|
/* 7d */ 0x6e3,
|
||||||
|
/* 7e */ 0x5e3,
|
||||||
|
/* 7f */ 0x6b3,
|
||||||
|
/* 80 */ 0x272,
|
||||||
|
/* 81 */ 0x1d2,
|
||||||
|
/* 82 */ 0x2d2,
|
||||||
|
/* 83 */ 0x71d,
|
||||||
|
/* 84 */ 0x352,
|
||||||
|
/* 85 */ 0x69d,
|
||||||
|
/* 86 */ 0x59d,
|
||||||
|
/* 87 */ 0x78d,
|
||||||
|
/* 88 */ 0x392,
|
||||||
|
/* 89 */ 0x65d,
|
||||||
|
/* 8a */ 0x55d,
|
||||||
|
/* 8b */ 0x74d,
|
||||||
|
/* 8c */ 0x4dd,
|
||||||
|
/* 8d */ 0x6cd,
|
||||||
|
/* 8e */ 0x5cd,
|
||||||
|
/* 8f */ 0x172,
|
||||||
|
/* 90 */ 0x1b2,
|
||||||
|
/* 91 */ 0x63d,
|
||||||
|
/* 92 */ 0x53d,
|
||||||
|
/* 93 */ 0x72d,
|
||||||
|
/* 94 */ 0x4bd,
|
||||||
|
/* 95 */ 0x6ad,
|
||||||
|
/* 96 */ 0x5ad,
|
||||||
|
/* 97 */ 0x3a2,
|
||||||
|
/* 98 */ 0x332,
|
||||||
|
/* 99 */ 0x66d,
|
||||||
|
/* 9a */ 0x56d,
|
||||||
|
/* 9b */ 0x362,
|
||||||
|
/* 9c */ 0x4ed,
|
||||||
|
/* 9d */ 0x2e2,
|
||||||
|
/* 9e */ 0x1e2,
|
||||||
|
/* 9f */ 0x2b2,
|
||||||
|
/* a0 */ 0x67a,
|
||||||
|
/* a1 */ 0x5da,
|
||||||
|
/* a2 */ 0x6da,
|
||||||
|
/* a3 */ 0x31a,
|
||||||
|
/* a4 */ 0x75a,
|
||||||
|
/* a5 */ 0x29a,
|
||||||
|
/* a6 */ 0x19a,
|
||||||
|
/* a7 */ 0x38a,
|
||||||
|
/* a8 */ 0x79a,
|
||||||
|
/* a9 */ 0x25a,
|
||||||
|
/* aa */ 0x15a,
|
||||||
|
/* ab */ 0x34a,
|
||||||
|
/* ac */ 0x0da,
|
||||||
|
/* ad */ 0x2ca,
|
||||||
|
/* ae */ 0x1ca,
|
||||||
|
/* af */ 0x57a,
|
||||||
|
/* b0 */ 0x5ba,
|
||||||
|
/* b1 */ 0x23a,
|
||||||
|
/* b2 */ 0x13a,
|
||||||
|
/* b3 */ 0x32a,
|
||||||
|
/* b4 */ 0x0ba,
|
||||||
|
/* b5 */ 0x2aa,
|
||||||
|
/* b6 */ 0x1aa,
|
||||||
|
/* b7 */ 0x7aa,
|
||||||
|
/* b8 */ 0x73a,
|
||||||
|
/* b9 */ 0x26a,
|
||||||
|
/* ba */ 0x16a,
|
||||||
|
/* bb */ 0x76a,
|
||||||
|
/* bc */ 0x0ea,
|
||||||
|
/* bd */ 0x6ea,
|
||||||
|
/* be */ 0x5ea,
|
||||||
|
/* bf */ 0x6ba,
|
||||||
|
/* c0 */ 0x676,
|
||||||
|
/* c1 */ 0x5d6,
|
||||||
|
/* c2 */ 0x6d6,
|
||||||
|
/* c3 */ 0x316,
|
||||||
|
/* c4 */ 0x756,
|
||||||
|
/* c5 */ 0x296,
|
||||||
|
/* c6 */ 0x196,
|
||||||
|
/* c7 */ 0x386,
|
||||||
|
/* c8 */ 0x796,
|
||||||
|
/* c9 */ 0x256,
|
||||||
|
/* ca */ 0x156,
|
||||||
|
/* cb */ 0x346,
|
||||||
|
/* cc */ 0x0d6,
|
||||||
|
/* cd */ 0x2c6,
|
||||||
|
/* ce */ 0x1c6,
|
||||||
|
/* cf */ 0x576,
|
||||||
|
/* d0 */ 0x5b6,
|
||||||
|
/* d1 */ 0x236,
|
||||||
|
/* d2 */ 0x136,
|
||||||
|
/* d3 */ 0x326,
|
||||||
|
/* d4 */ 0x0b6,
|
||||||
|
/* d5 */ 0x2a6,
|
||||||
|
/* d6 */ 0x1a6,
|
||||||
|
/* d7 */ 0x7a6,
|
||||||
|
/* d8 */ 0x736,
|
||||||
|
/* d9 */ 0x266,
|
||||||
|
/* da */ 0x166,
|
||||||
|
/* db */ 0x766,
|
||||||
|
/* dc */ 0x0e6,
|
||||||
|
/* dd */ 0x6e6,
|
||||||
|
/* de */ 0x5e6,
|
||||||
|
/* df */ 0x6b6,
|
||||||
|
/* e0 */ 0x271,
|
||||||
|
/* e1 */ 0x1d1,
|
||||||
|
/* e2 */ 0x2d1,
|
||||||
|
/* e3 */ 0x71e,
|
||||||
|
/* e4 */ 0x351,
|
||||||
|
/* e5 */ 0x69e,
|
||||||
|
/* e6 */ 0x59e,
|
||||||
|
/* e7 */ 0x78e,
|
||||||
|
/* e8 */ 0x391,
|
||||||
|
/* e9 */ 0x65e,
|
||||||
|
/* ea */ 0x55e,
|
||||||
|
/* eb */ 0x74e,
|
||||||
|
/* ec */ 0x4de,
|
||||||
|
/* ed */ 0x6ce,
|
||||||
|
/* ee */ 0x5ce,
|
||||||
|
/* ef */ 0x171,
|
||||||
|
/* f0 */ 0x1b1,
|
||||||
|
/* f1 */ 0x637,
|
||||||
|
/* f2 */ 0x537,
|
||||||
|
/* f3 */ 0x72e,
|
||||||
|
/* f4 */ 0x4b7,
|
||||||
|
/* f5 */ 0x6ae,
|
||||||
|
/* f6 */ 0x5ae,
|
||||||
|
/* f7 */ 0x3a1,
|
||||||
|
/* f8 */ 0x331,
|
||||||
|
/* f9 */ 0x66e,
|
||||||
|
/* fa */ 0x56e,
|
||||||
|
/* fb */ 0x361,
|
||||||
|
/* fc */ 0x4ee,
|
||||||
|
/* fd */ 0x2e1,
|
||||||
|
/* fe */ 0x1e1,
|
||||||
|
/* ff */ 0x2b1,
|
||||||
|
}, // RD = +1 cases
|
||||||
|
{
|
||||||
|
/* 00 */ 0x58b,
|
||||||
|
/* 01 */ 0x62b,
|
||||||
|
/* 02 */ 0x52b,
|
||||||
|
/* 03 */ 0x314,
|
||||||
|
/* 04 */ 0x4ab,
|
||||||
|
/* 05 */ 0x294,
|
||||||
|
/* 06 */ 0x194,
|
||||||
|
/* 07 */ 0x074,
|
||||||
|
/* 08 */ 0x46b,
|
||||||
|
/* 09 */ 0x254,
|
||||||
|
/* 0a */ 0x154,
|
||||||
|
/* 0b */ 0x344,
|
||||||
|
/* 0c */ 0x0d4,
|
||||||
|
/* 0d */ 0x2c4,
|
||||||
|
/* 0e */ 0x1c4,
|
||||||
|
/* 0f */ 0x68b,
|
||||||
|
/* 10 */ 0x64b,
|
||||||
|
/* 11 */ 0x234,
|
||||||
|
/* 12 */ 0x134,
|
||||||
|
/* 13 */ 0x324,
|
||||||
|
/* 14 */ 0x0b4,
|
||||||
|
/* 15 */ 0x2a4,
|
||||||
|
/* 16 */ 0x1a4,
|
||||||
|
/* 17 */ 0x45b,
|
||||||
|
/* 18 */ 0x4cb,
|
||||||
|
/* 19 */ 0x264,
|
||||||
|
/* 1a */ 0x164,
|
||||||
|
/* 1b */ 0x49b,
|
||||||
|
/* 1c */ 0x0e4,
|
||||||
|
/* 1d */ 0x51b,
|
||||||
|
/* 1e */ 0x61b,
|
||||||
|
/* 1f */ 0x54b,
|
||||||
|
/* 20 */ 0x189,
|
||||||
|
/* 21 */ 0x229,
|
||||||
|
/* 22 */ 0x129,
|
||||||
|
/* 23 */ 0x719,
|
||||||
|
/* 24 */ 0x0a9,
|
||||||
|
/* 25 */ 0x699,
|
||||||
|
/* 26 */ 0x599,
|
||||||
|
/* 27 */ 0x479,
|
||||||
|
/* 28 */ 0x069,
|
||||||
|
/* 29 */ 0x659,
|
||||||
|
/* 2a */ 0x559,
|
||||||
|
/* 2b */ 0x749,
|
||||||
|
/* 2c */ 0x4d9,
|
||||||
|
/* 2d */ 0x6c9,
|
||||||
|
/* 2e */ 0x5c9,
|
||||||
|
/* 2f */ 0x289,
|
||||||
|
/* 30 */ 0x249,
|
||||||
|
/* 31 */ 0x639,
|
||||||
|
/* 32 */ 0x539,
|
||||||
|
/* 33 */ 0x729,
|
||||||
|
/* 34 */ 0x4b9,
|
||||||
|
/* 35 */ 0x6a9,
|
||||||
|
/* 36 */ 0x5a9,
|
||||||
|
/* 37 */ 0x059,
|
||||||
|
/* 38 */ 0x0c9,
|
||||||
|
/* 39 */ 0x669,
|
||||||
|
/* 3a */ 0x569,
|
||||||
|
/* 3b */ 0x099,
|
||||||
|
/* 3c */ 0x4e9,
|
||||||
|
/* 3d */ 0x119,
|
||||||
|
/* 3e */ 0x219,
|
||||||
|
/* 3f */ 0x149,
|
||||||
|
/* 40 */ 0x185,
|
||||||
|
/* 41 */ 0x225,
|
||||||
|
/* 42 */ 0x125,
|
||||||
|
/* 43 */ 0x715,
|
||||||
|
/* 44 */ 0x0a5,
|
||||||
|
/* 45 */ 0x695,
|
||||||
|
/* 46 */ 0x595,
|
||||||
|
/* 47 */ 0x475,
|
||||||
|
/* 48 */ 0x065,
|
||||||
|
/* 49 */ 0x655,
|
||||||
|
/* 4a */ 0x555,
|
||||||
|
/* 4b */ 0x745,
|
||||||
|
/* 4c */ 0x4d5,
|
||||||
|
/* 4d */ 0x6c5,
|
||||||
|
/* 4e */ 0x5c5,
|
||||||
|
/* 4f */ 0x285,
|
||||||
|
/* 50 */ 0x245,
|
||||||
|
/* 51 */ 0x635,
|
||||||
|
/* 52 */ 0x535,
|
||||||
|
/* 53 */ 0x725,
|
||||||
|
/* 54 */ 0x4b5,
|
||||||
|
/* 55 */ 0x6a5,
|
||||||
|
/* 56 */ 0x5a5,
|
||||||
|
/* 57 */ 0x055,
|
||||||
|
/* 58 */ 0x0c5,
|
||||||
|
/* 59 */ 0x665,
|
||||||
|
/* 5a */ 0x565,
|
||||||
|
/* 5b */ 0x095,
|
||||||
|
/* 5c */ 0x4e5,
|
||||||
|
/* 5d */ 0x115,
|
||||||
|
/* 5e */ 0x215,
|
||||||
|
/* 5f */ 0x145,
|
||||||
|
/* 60 */ 0x18c,
|
||||||
|
/* 61 */ 0x22c,
|
||||||
|
/* 62 */ 0x12c,
|
||||||
|
/* 63 */ 0x713,
|
||||||
|
/* 64 */ 0x0ac,
|
||||||
|
/* 65 */ 0x693,
|
||||||
|
/* 66 */ 0x593,
|
||||||
|
/* 67 */ 0x473,
|
||||||
|
/* 68 */ 0x06c,
|
||||||
|
/* 69 */ 0x653,
|
||||||
|
/* 6a */ 0x553,
|
||||||
|
/* 6b */ 0x743,
|
||||||
|
/* 6c */ 0x4d3,
|
||||||
|
/* 6d */ 0x6c3,
|
||||||
|
/* 6e */ 0x5c3,
|
||||||
|
/* 6f */ 0x28c,
|
||||||
|
/* 70 */ 0x24c,
|
||||||
|
/* 71 */ 0x633,
|
||||||
|
/* 72 */ 0x533,
|
||||||
|
/* 73 */ 0x723,
|
||||||
|
/* 74 */ 0x4b3,
|
||||||
|
/* 75 */ 0x6a3,
|
||||||
|
/* 76 */ 0x5a3,
|
||||||
|
/* 77 */ 0x05c,
|
||||||
|
/* 78 */ 0x0cc,
|
||||||
|
/* 79 */ 0x663,
|
||||||
|
/* 7a */ 0x563,
|
||||||
|
/* 7b */ 0x09c,
|
||||||
|
/* 7c */ 0x4e3,
|
||||||
|
/* 7d */ 0x11c,
|
||||||
|
/* 7e */ 0x21c,
|
||||||
|
/* 7f */ 0x14c,
|
||||||
|
/* 80 */ 0x58d,
|
||||||
|
/* 81 */ 0x62d,
|
||||||
|
/* 82 */ 0x52d,
|
||||||
|
/* 83 */ 0x312,
|
||||||
|
/* 84 */ 0x4ad,
|
||||||
|
/* 85 */ 0x292,
|
||||||
|
/* 86 */ 0x192,
|
||||||
|
/* 87 */ 0x072,
|
||||||
|
/* 88 */ 0x46d,
|
||||||
|
/* 89 */ 0x252,
|
||||||
|
/* 8a */ 0x152,
|
||||||
|
/* 8b */ 0x342,
|
||||||
|
/* 8c */ 0x0d2,
|
||||||
|
/* 8d */ 0x2c2,
|
||||||
|
/* 8e */ 0x1c2,
|
||||||
|
/* 8f */ 0x68d,
|
||||||
|
/* 90 */ 0x64d,
|
||||||
|
/* 91 */ 0x232,
|
||||||
|
/* 92 */ 0x132,
|
||||||
|
/* 93 */ 0x322,
|
||||||
|
/* 94 */ 0x0b2,
|
||||||
|
/* 95 */ 0x2a2,
|
||||||
|
/* 96 */ 0x1a2,
|
||||||
|
/* 97 */ 0x45d,
|
||||||
|
/* 98 */ 0x4cd,
|
||||||
|
/* 99 */ 0x262,
|
||||||
|
/* 9a */ 0x162,
|
||||||
|
/* 9b */ 0x49d,
|
||||||
|
/* 9c */ 0x0e2,
|
||||||
|
/* 9d */ 0x51d,
|
||||||
|
/* 9e */ 0x61d,
|
||||||
|
/* 9f */ 0x54d,
|
||||||
|
/* a0 */ 0x18a,
|
||||||
|
/* a1 */ 0x22a,
|
||||||
|
/* a2 */ 0x12a,
|
||||||
|
/* a3 */ 0x71a,
|
||||||
|
/* a4 */ 0x0aa,
|
||||||
|
/* a5 */ 0x69a,
|
||||||
|
/* a6 */ 0x59a,
|
||||||
|
/* a7 */ 0x47a,
|
||||||
|
/* a8 */ 0x06a,
|
||||||
|
/* a9 */ 0x65a,
|
||||||
|
/* aa */ 0x55a,
|
||||||
|
/* ab */ 0x74a,
|
||||||
|
/* ac */ 0x4da,
|
||||||
|
/* ad */ 0x6ca,
|
||||||
|
/* ae */ 0x5ca,
|
||||||
|
/* af */ 0x28a,
|
||||||
|
/* b0 */ 0x24a,
|
||||||
|
/* b1 */ 0x63a,
|
||||||
|
/* b2 */ 0x53a,
|
||||||
|
/* b3 */ 0x72a,
|
||||||
|
/* b4 */ 0x4ba,
|
||||||
|
/* b5 */ 0x6aa,
|
||||||
|
/* b6 */ 0x5aa,
|
||||||
|
/* b7 */ 0x05a,
|
||||||
|
/* b8 */ 0x0ca,
|
||||||
|
/* b9 */ 0x66a,
|
||||||
|
/* ba */ 0x56a,
|
||||||
|
/* bb */ 0x09a,
|
||||||
|
/* bc */ 0x4ea,
|
||||||
|
/* bd */ 0x11a,
|
||||||
|
/* be */ 0x21a,
|
||||||
|
/* bf */ 0x14a,
|
||||||
|
/* c0 */ 0x186,
|
||||||
|
/* c1 */ 0x226,
|
||||||
|
/* c2 */ 0x126,
|
||||||
|
/* c3 */ 0x716,
|
||||||
|
/* c4 */ 0x0a6,
|
||||||
|
/* c5 */ 0x696,
|
||||||
|
/* c6 */ 0x596,
|
||||||
|
/* c7 */ 0x476,
|
||||||
|
/* c8 */ 0x066,
|
||||||
|
/* c9 */ 0x656,
|
||||||
|
/* ca */ 0x556,
|
||||||
|
/* cb */ 0x746,
|
||||||
|
/* cc */ 0x4d6,
|
||||||
|
/* cd */ 0x6c6,
|
||||||
|
/* ce */ 0x5c6,
|
||||||
|
/* cf */ 0x286,
|
||||||
|
/* d0 */ 0x246,
|
||||||
|
/* d1 */ 0x636,
|
||||||
|
/* d2 */ 0x536,
|
||||||
|
/* d3 */ 0x726,
|
||||||
|
/* d4 */ 0x4b6,
|
||||||
|
/* d5 */ 0x6a6,
|
||||||
|
/* d6 */ 0x5a6,
|
||||||
|
/* d7 */ 0x056,
|
||||||
|
/* d8 */ 0x0c6,
|
||||||
|
/* d9 */ 0x666,
|
||||||
|
/* da */ 0x566,
|
||||||
|
/* db */ 0x096,
|
||||||
|
/* dc */ 0x4e6,
|
||||||
|
/* dd */ 0x116,
|
||||||
|
/* de */ 0x216,
|
||||||
|
/* df */ 0x146,
|
||||||
|
/* e0 */ 0x58e,
|
||||||
|
/* e1 */ 0x62e,
|
||||||
|
/* e2 */ 0x52e,
|
||||||
|
/* e3 */ 0x311,
|
||||||
|
/* e4 */ 0x4ae,
|
||||||
|
/* e5 */ 0x291,
|
||||||
|
/* e6 */ 0x191,
|
||||||
|
/* e7 */ 0x071,
|
||||||
|
/* e8 */ 0x46e,
|
||||||
|
/* e9 */ 0x251,
|
||||||
|
/* ea */ 0x151,
|
||||||
|
/* eb */ 0x348,
|
||||||
|
/* ec */ 0x0d1,
|
||||||
|
/* ed */ 0x2c8,
|
||||||
|
/* ee */ 0x1c8,
|
||||||
|
/* ef */ 0x68e,
|
||||||
|
/* f0 */ 0x64e,
|
||||||
|
/* f1 */ 0x231,
|
||||||
|
/* f2 */ 0x131,
|
||||||
|
/* f3 */ 0x321,
|
||||||
|
/* f4 */ 0x0b1,
|
||||||
|
/* f5 */ 0x2a1,
|
||||||
|
/* f6 */ 0x1a1,
|
||||||
|
/* f7 */ 0x45e,
|
||||||
|
/* f8 */ 0x4ce,
|
||||||
|
/* f9 */ 0x261,
|
||||||
|
/* fa */ 0x161,
|
||||||
|
/* fb */ 0x49e,
|
||||||
|
/* fc */ 0x0e1,
|
||||||
|
/* fd */ 0x51e,
|
||||||
|
/* fe */ 0x61e,
|
||||||
|
/* ff */ 0x54e,
|
||||||
|
} };
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,322 @@
|
|||||||
|
/*
|
||||||
|
* Generates telemetry for CubeSat Simulator
|
||||||
|
*
|
||||||
|
* Copyright Alan B. Johnston
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* INA219 Raspberry Pi wiringPi code is based on Adafruit Arduino wire code
|
||||||
|
* from https://github.com/adafruit/Adafruit_INA219.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "status.h"
|
||||||
|
#include "ax5043.h"
|
||||||
|
#include "ax25.h"
|
||||||
|
#include "spi/ax5043spi.h"
|
||||||
|
#include <wiringPiI2C.h>
|
||||||
|
#include <wiringPi.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "Adafruit_INA219.h" // From Adafruit INA219 library for Arduino
|
||||||
|
|
||||||
|
#define A 1
|
||||||
|
#define B 2
|
||||||
|
#define C 3
|
||||||
|
#define D 4
|
||||||
|
|
||||||
|
#define PLUS_X 0
|
||||||
|
#define PLUS_Y 1
|
||||||
|
#define PLUS_Z 2
|
||||||
|
#define BAT 3
|
||||||
|
#define MINUS_X 4
|
||||||
|
#define MINUS_Y 5
|
||||||
|
#define MINUS_Z 6
|
||||||
|
#define BUS 7
|
||||||
|
#define OFF -1
|
||||||
|
|
||||||
|
int twosToInt(int val, int len);
|
||||||
|
|
||||||
|
struct SensorConfig {
|
||||||
|
int fd;
|
||||||
|
uint16_t config;
|
||||||
|
int calValue;
|
||||||
|
int powerMultiplier;
|
||||||
|
int currentDivider;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SensorData {
|
||||||
|
double current;
|
||||||
|
double voltage;
|
||||||
|
double power;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read the data from one of the i2c current sensors.
|
||||||
|
*
|
||||||
|
* Reads the current data from the requested i2c current sensor configuration and
|
||||||
|
* stores it into a SensorData struct. An invalid file descriptor (i.e. less than zero)
|
||||||
|
* results in a SensorData struct being returned that has both its #current and #power members
|
||||||
|
* set to NAN.
|
||||||
|
*
|
||||||
|
* @param sensor A structure containing sensor configuration including the file descriptor.
|
||||||
|
* @return struct SensorData A struct that contains the current, voltage, and power readings
|
||||||
|
* from the requested sensor.
|
||||||
|
*/
|
||||||
|
struct SensorData read_sensor_data(struct SensorConfig sensor) {
|
||||||
|
struct SensorData data = {
|
||||||
|
.current = 0,
|
||||||
|
.voltage = 0,
|
||||||
|
.power = 0 };
|
||||||
|
|
||||||
|
if (sensor.fd < 0) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
// doesn't read negative currents accurately, shows -0.1mA
|
||||||
|
wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CALIBRATION, sensor.calValue);
|
||||||
|
wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CONFIG, sensor.config);
|
||||||
|
wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CALIBRATION, sensor.calValue);
|
||||||
|
delay(1);
|
||||||
|
int value = wiringPiI2CReadReg16(sensor.fd, INA219_REG_CURRENT);
|
||||||
|
if (value == -1)
|
||||||
|
{
|
||||||
|
sensor.fd = -1;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
data.current = (float) twosToInt(value, 16) / (float) sensor.currentDivider;
|
||||||
|
|
||||||
|
wiringPiI2CWrite(sensor.fd, INA219_REG_BUSVOLTAGE);
|
||||||
|
delay(1); // Max 12-bit conversion time is 586us per sample
|
||||||
|
value = (wiringPiI2CRead(sensor.fd) << 8 ) | wiringPiI2CRead (sensor.fd);
|
||||||
|
data.voltage = ((float)(value >> 3) * 4) / 1000;
|
||||||
|
// power has very low resolution, seems to step in 512mW values
|
||||||
|
delay(1);
|
||||||
|
data.power = (float) wiringPiI2CReadReg16(sensor.fd, INA219_REG_POWER) * (float) sensor.powerMultiplier;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configures an i2c current sensor.
|
||||||
|
*
|
||||||
|
* Calculates the configuration values of the i2c sensor so that
|
||||||
|
* current, voltage, and power can be read using read_sensor_data.
|
||||||
|
* Supports 16V 400mA and 16V 2.0A settings.
|
||||||
|
*
|
||||||
|
* @param sensor A file descriptor that can be used to read from the sensor.
|
||||||
|
* @param milliAmps The mA configuration, either 400mA or 2A are supported.
|
||||||
|
* @return struct SensorConfig A struct that contains the configuraton of the sensor.
|
||||||
|
*/
|
||||||
|
//struct SensorConfig config_sensor(int sensor, int milliAmps) {
|
||||||
|
struct SensorConfig config_sensor(char *bus, int address, int milliAmps) {
|
||||||
|
struct SensorConfig data;
|
||||||
|
|
||||||
|
if (access(bus, W_OK | R_OK) < 0) { // Test if I2C Bus is missing
|
||||||
|
printf("ERROR: %s bus not present \n", bus);
|
||||||
|
data.fd = OFF;
|
||||||
|
return (data);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.fd = wiringPiI2CSetupInterface(bus, address);
|
||||||
|
|
||||||
|
data.config = INA219_CONFIG_BVOLTAGERANGE_32V |
|
||||||
|
INA219_CONFIG_GAIN_1_40MV |
|
||||||
|
INA219_CONFIG_BADCRES_12BIT |
|
||||||
|
INA219_CONFIG_SADCRES_12BIT_1S_532US |
|
||||||
|
INA219_CONFIG_MODE_SANDBVOLT_CONTINUOUS;
|
||||||
|
|
||||||
|
if (milliAmps == 400) { // INA219 16V 400mA configuration
|
||||||
|
data.calValue = 8192;
|
||||||
|
data.powerMultiplier = 1;
|
||||||
|
data.currentDivider = 20; // 40; in Adafruit config
|
||||||
|
}
|
||||||
|
else { // INA219 16V 2A configuration
|
||||||
|
data.calValue = 40960;
|
||||||
|
data.powerMultiplier = 2;
|
||||||
|
data.currentDivider = 10; // 20; in Adafruit config
|
||||||
|
}
|
||||||
|
|
||||||
|
//#ifdef DEBUG_LOGGING
|
||||||
|
// printf("Sensor %s %x configuration: %d %d %d %d %d\n", bus, address, data.fd,
|
||||||
|
// data.config, data.calValue, data.currentDivider, data.powerMultiplier);
|
||||||
|
// printf("Sensor %s %x | ", bus, address);
|
||||||
|
//#endif
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SensorConfig sensorV;
|
||||||
|
struct SensorData readingV;
|
||||||
|
struct SensorConfig tempSensor;
|
||||||
|
struct SensorConfig sensor[8]; // 8 current sensors in Solar Power PCB vB4/5
|
||||||
|
struct SensorData reading[8]; // 8 current sensors in Solar Power PCB vB4/5
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
wiringPiSetup ();
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
pinMode (2, INPUT);
|
||||||
|
pullUpDnControl (2, PUD_UP);
|
||||||
|
|
||||||
|
if (digitalRead(2) != HIGH)
|
||||||
|
{
|
||||||
|
printf("vB3 with TFB Present\n");
|
||||||
|
sensor[PLUS_X] = config_sensor("/dev/i2c-1", 0x40, 400);
|
||||||
|
sensor[PLUS_Y] = config_sensor("/dev/i2c-1", 0x41, 400);
|
||||||
|
sensor[PLUS_Z] = config_sensor("/dev/i2c-1", 0x44, 400);
|
||||||
|
sensor[BAT] = config_sensor("/dev/i2c-1", 0x45, 400);
|
||||||
|
sensor[BUS] = config_sensor("/dev/i2c-1", 0x4a, 2000);
|
||||||
|
sensor[MINUS_X] = config_sensor("/dev/i2c-0", 0x40, 400);
|
||||||
|
sensor[MINUS_Y] = config_sensor("/dev/i2c-0", 0x41, 400);
|
||||||
|
sensor[MINUS_Z] = config_sensor("/dev/i2c-0", 0x44, 400); }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pinMode (3, INPUT);
|
||||||
|
pullUpDnControl (3, PUD_UP);
|
||||||
|
|
||||||
|
if (digitalRead(3) != HIGH)
|
||||||
|
{
|
||||||
|
printf("vB4 Present\n");
|
||||||
|
sensor[PLUS_X] = config_sensor("/dev/i2c-1", 0x40, 400);
|
||||||
|
sensor[PLUS_Y] = config_sensor("/dev/i2c-1", 0x41, 400);
|
||||||
|
sensor[BUS] = config_sensor("/dev/i2c-1", 0x44, 400);
|
||||||
|
sensor[BAT] = config_sensor("/dev/i2c-1", 0x45, 400);
|
||||||
|
sensor[PLUS_Z] = config_sensor("/dev/i2c-0", 0x40, 400);
|
||||||
|
sensor[MINUS_X] = config_sensor("/dev/i2c-0", 0x41, 400);
|
||||||
|
sensor[MINUS_Y] = config_sensor("/dev/i2c-0", 0x44, 400);
|
||||||
|
sensor[MINUS_Z] = config_sensor("/dev/i2c-0", 0x45, 400);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pinMode (26, INPUT);
|
||||||
|
pullUpDnControl (26, PUD_UP);
|
||||||
|
|
||||||
|
if (digitalRead(26) != HIGH)
|
||||||
|
{
|
||||||
|
printf("vB5 Present\n");
|
||||||
|
sensor[PLUS_X] = config_sensor("/dev/i2c-1", 0x40, 400);
|
||||||
|
sensor[PLUS_Y] = config_sensor("/dev/i2c-1", 0x41, 400);
|
||||||
|
sensor[BUS] = config_sensor("/dev/i2c-1", 0x45, 400);
|
||||||
|
sensor[BAT] = config_sensor("/dev/i2c-1", 0x44, 400);
|
||||||
|
sensor[PLUS_Z] = config_sensor("/dev/i2c-3", 0x40, 400);
|
||||||
|
sensor[MINUS_X] = config_sensor("/dev/i2c-3", 0x41, 400);
|
||||||
|
sensor[MINUS_Y] = config_sensor("/dev/i2c-3", 0x44, 400);
|
||||||
|
sensor[MINUS_Z] = config_sensor("/dev/i2c-3", 0x45, 400);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("VB3 Present\n");
|
||||||
|
sensor[PLUS_X] = config_sensor("/dev/i2c-1", 0x40, 400);
|
||||||
|
sensor[PLUS_Y] = config_sensor("/dev/i2c-1", 0x41, 400);
|
||||||
|
sensor[PLUS_Z] = config_sensor("/dev/i2c-1", 0x44, 400);
|
||||||
|
sensor[BAT] = config_sensor("/dev/i2c-1", 0x45, 400);
|
||||||
|
sensor[BUS] = config_sensor("/dev/i2c-1", 0x4a, 2000);
|
||||||
|
sensor[MINUS_X] = config_sensor("/dev/i2c-0", 0x40, 400);
|
||||||
|
sensor[MINUS_Y] = config_sensor("/dev/i2c-0", 0x41, 400);
|
||||||
|
sensor[MINUS_Z] = config_sensor("/dev/i2c-0", 0x44, 400); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reading I2C voltage and current sensors
|
||||||
|
int count;
|
||||||
|
for (count = 0; count < 8; count++)
|
||||||
|
{
|
||||||
|
reading[count] = read_sensor_data(sensor[count]);
|
||||||
|
// printf("Read sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// count, reading[count].voltage, reading[count].current, reading[count].power);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
// sensorV = config_sensor("/dev/i2c-1", 0x40, 400);
|
||||||
|
// readingV = read_sensor_data(sensorV);
|
||||||
|
printf("+X | sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// PLUS_X, readingV.voltage, readingV.current, readingV.power);
|
||||||
|
PLUS_X, reading[PLUS_X].voltage, reading[PLUS_X].current, reading[PLUS_X].power);
|
||||||
|
|
||||||
|
// sensorV = config_sensor("/dev/i2c-1", 0x41, 400);
|
||||||
|
// readingV = read_sensor_data(sensorV);
|
||||||
|
printf("+Y | sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// PLUS_Y, readingV.voltage, readingV.current, readingV.power);
|
||||||
|
PLUS_Y, reading[PLUS_Y].voltage, reading[PLUS_Y].current, reading[PLUS_Y].power);
|
||||||
|
|
||||||
|
//sensorV = config_sensor("/dev/i2c-0", 0x40, 400);
|
||||||
|
//readingV = read_sensor_data(sensorV);
|
||||||
|
printf("+Z | sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// PLUS_Z, readingV.voltage, readingV.current, readingV.power);
|
||||||
|
PLUS_Z, reading[PLUS_Z].voltage, reading[PLUS_Z].current, reading[PLUS_Z].power);
|
||||||
|
|
||||||
|
// sensorV = config_sensor("/dev/i2c-0", 0x41, 400);
|
||||||
|
// readingV = read_sensor_data(sensorV);
|
||||||
|
printf("-X | sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// MINUS_X, readingV.voltage, readingV.current, readingV.power);
|
||||||
|
MINUS_X, reading[MINUS_X].voltage, reading[MINUS_X].current, reading[MINUS_X].power);
|
||||||
|
|
||||||
|
// sensorV = config_sensor("/dev/i2c-0", 0x44, 400);
|
||||||
|
// readingV = read_sensor_data(sensorV);
|
||||||
|
printf("-Y | sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// MINUS_Y, readingV.voltage, readingV.current, readingV.power);
|
||||||
|
MINUS_Y, reading[MINUS_Y].voltage, reading[MINUS_Y].current, reading[MINUS_Y].power);
|
||||||
|
|
||||||
|
//sensorV = config_sensor("/dev/i2c-0", 0x45, 400);
|
||||||
|
// readingV = read_sensor_data(sensorV);
|
||||||
|
printf("-Z | sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// MINUS_Z, readingV.voltage, readingV.current, readingV.power);
|
||||||
|
MINUS_Z, reading[MINUS_Z].voltage, reading[MINUS_Z].current, reading[MINUS_Z].power);
|
||||||
|
|
||||||
|
// sensorV = config_sensor("/dev/i2c-1", 0x45, 400);
|
||||||
|
// readingV = read_sensor_data(sensorV);
|
||||||
|
printf("Bat | sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// BAT, readingV.voltage, readingV.current, readingV.power);
|
||||||
|
BAT, reading[BAT].voltage, reading[BAT].current, reading[BAT].power);
|
||||||
|
|
||||||
|
// sensorV = config_sensor("/dev/i2c-1", 0x44, 400);
|
||||||
|
// readingV = read_sensor_data(sensorV);
|
||||||
|
printf("Bus | sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n",
|
||||||
|
// BUS, readingV.voltage, readingV.current, readingV.power);
|
||||||
|
BUS, reading[BUS].voltage, reading[BUS].current, reading[BUS].power);
|
||||||
|
|
||||||
|
/*
|
||||||
|
sensorV = config_sensor("/dev/i2c-3", 0x48, 0);
|
||||||
|
if (sensorV.fd != OFF) {
|
||||||
|
int tempValue = wiringPiI2CReadReg16(sensorV.fd, 0);
|
||||||
|
uint8_t upper = (uint8_t) (tempValue >> 8);
|
||||||
|
uint8_t lower = (uint8_t) (tempValue & 0xff);
|
||||||
|
float temp = (float)lower + ((float)upper / 0x100);
|
||||||
|
printf("T | % 4.1f C \n", temp);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
printf("\n\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int twosToInt(int val,int len) { // Convert twos compliment to integer
|
||||||
|
// from https://www.raspberrypi.org/forums/viewtopic.php?t=55815
|
||||||
|
|
||||||
|
if(val & (1 << (len - 1)))
|
||||||
|
val = val - (1 << len);
|
||||||
|
|
||||||
|
return(val);
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,28 @@
|
|||||||
|
// code for STM32F104C on the CubeSat Simulator STEM Payload board
|
||||||
|
// answers "OK" on the serial port when queried by the Pi
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial1.begin(9600);
|
||||||
|
pinMode(PC13, OUTPUT);
|
||||||
|
digitalWrite(PC13, LOW); // turn the LED on
|
||||||
|
delay(50); // wait for a second
|
||||||
|
digitalWrite(PC13, HIGH); // turn the LED off
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
|
||||||
|
if (Serial1.available() > 0) {
|
||||||
|
digitalWrite(PC13, LOW); // turn the LED on
|
||||||
|
delay(50); // wait for a second
|
||||||
|
digitalWrite(PC13, HIGH); // turn the LED off
|
||||||
|
char result = Serial1.read();
|
||||||
|
// Serial1.println(result);
|
||||||
|
Serial1.println("OK");
|
||||||
|
// Serial1.println(counter++);
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(100);
|
||||||
|
}
|
||||||
@ -1,12 +1,32 @@
|
|||||||
This code is used on an Arduino acting as a payload to the CubeSat Simulator.
|
This code is used on the STM32 acting a payload to the CubeSat Simulator.
|
||||||
|
|
||||||
The Arduino is on the Raspberry Pi i2c bus 0, address 0x4b
|
The interface is via the Serial1 port on the STM32 (pins PA9 and PA10) and the Raspberry Pi UART (pins 8 and 10)
|
||||||
|
|
||||||
The 2c_master_register_read.ino code emulates the register reading of the Raspberry Pi. You can connect two Arduinos back-to-back to show this.
|
The STM32 can be programmed using the Arduino IDE with the Generic STM32F103C series board and STM32duino bootloader, Maple Mini port.
|
||||||
|
|
||||||
The i2c_slave_register_read.ino code responds to register reads from a bus master such as another Arduino or the Raspberry Pi
|
On the Raspberry Pi, to enable the UART:
|
||||||
|
|
||||||
The i2c_slave_with_sensor_reading.ino code responds to register reads from a bus master and has placeholders for reading a sensor.
|
sudo nano /boot/config.txt
|
||||||
|
|
||||||
|
Add the following line:
|
||||||
|
|
||||||
|
dtoverlay=pi3-miniuart-bt
|
||||||
|
|
||||||
|
Edit cmdline.txt:
|
||||||
|
|
||||||
|
sudo nano /boot/cmdline.txt
|
||||||
|
|
||||||
|
Remove the following text in cmdline.txt to prevent a console from running on the serial port:
|
||||||
|
|
||||||
|
console=serial0,115200
|
||||||
|
|
||||||
|
then reboot. You can test it with minicom:
|
||||||
|
|
||||||
|
sudo apt-get install minicom
|
||||||
|
|
||||||
|
minicom -b 9600 -o -D /dev/serial0
|
||||||
|
|
||||||
|
Type Control-A, then X, then Return to exit.
|
||||||
|
|
||||||
See https://github.com/alanbjohnston/CubeSatSim/wiki/Arduino-Payload for ideas on using the Arduino as a payload for the CubeSat Simulator.
|
See https://github.com/alanbjohnston/CubeSatSim/wiki/Arduino-Payload for ideas on using the Arduino as a payload for the CubeSat Simulator.
|
||||||
|
|
||||||
|
|||||||
@ -1,55 +0,0 @@
|
|||||||
// Wire Master Reader
|
|
||||||
// by Nicholas Zambetti <http://www.zambetti.com>
|
|
||||||
|
|
||||||
// Demonstrates use of the Wire library
|
|
||||||
// Reads data from an I2C/TWI slave device
|
|
||||||
// Refer to the "Wire Slave Sender" example for use with this
|
|
||||||
|
|
||||||
// Created 29 March 2006
|
|
||||||
|
|
||||||
// This example code is in the public domain.
|
|
||||||
|
|
||||||
// modified by Alan Johnston to show reading registers 0 - 3
|
|
||||||
// code based on https://forum.arduino.cc/index.php?topic=211587.0
|
|
||||||
//
|
|
||||||
// This code is to simulate the Raspberry Pi acting as I2C bus master
|
|
||||||
|
|
||||||
#include <Wire.h>
|
|
||||||
#define I2C_ADDRESS 0x4B
|
|
||||||
#define REGISTER_0 0x00
|
|
||||||
#define REGISTER_1 0x01
|
|
||||||
#define REGISTER_2 0x02
|
|
||||||
#define REGISTER_3 0x03
|
|
||||||
|
|
||||||
uint8_t reg; // I2C read register
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Wire.begin(); // join i2c bus (address optional for master)
|
|
||||||
Serial.begin(9600); // start serial for output
|
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
|
||||||
Serial.println("Starting");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
for (reg=0; reg < 4; reg++) {
|
|
||||||
delay(5000);
|
|
||||||
digitalWrite(LED_BUILTIN, HIGH);
|
|
||||||
Wire.beginTransmission(I2C_ADDRESS);
|
|
||||||
Wire.write(reg);
|
|
||||||
Wire.endTransmission();
|
|
||||||
delay(100);
|
|
||||||
digitalWrite(LED_BUILTIN, LOW);
|
|
||||||
|
|
||||||
|
|
||||||
Wire.requestFrom(I2C_ADDRESS, 2); // request 2 bytes from I2C device
|
|
||||||
byte LSB = Wire.read();
|
|
||||||
byte MSB = Wire.read();
|
|
||||||
|
|
||||||
uint16_t register_value = ((MSB << 8) | LSB);
|
|
||||||
|
|
||||||
Serial.print("Read ");
|
|
||||||
Serial.print(register_value, HEX); // display register value in HEXADECIMAL
|
|
||||||
Serial.print(" from register ");
|
|
||||||
Serial.println(reg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
// Arduino I2C slave for reading 16 bit registers
|
|
||||||
//
|
|
||||||
// by Alan Johnston
|
|
||||||
//
|
|
||||||
// based on
|
|
||||||
|
|
||||||
#include <Wire.h>
|
|
||||||
#define I2C_ADDRESS 0x4B
|
|
||||||
#define REGISTER_0 0x00
|
|
||||||
#define REGISTER_1 0x01
|
|
||||||
#define REGISTER_2 0x02
|
|
||||||
#define REGISTER_3 0x03
|
|
||||||
|
|
||||||
uint8_t reg; // I2C read register
|
|
||||||
|
|
||||||
unsigned int reg_0_value, reg_1_value, reg_2_value, reg_3_value; // register variables
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
|
|
||||||
Wire.begin(I2C_ADDRESS);
|
|
||||||
Wire.setClock(400000); // set I2C clock for full speed
|
|
||||||
digitalWrite(A4, LOW);
|
|
||||||
digitalWrite(A5, LOW);
|
|
||||||
Wire.onRequest(requestEvent);
|
|
||||||
Wire.onReceive(receiveEvent);
|
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
|
||||||
Serial.begin(9600); // start serial for output
|
|
||||||
Serial.println();
|
|
||||||
Serial.println("Starting");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
Serial.println("Waiting for register read");
|
|
||||||
|
|
||||||
// Read from sensor here and set register variables
|
|
||||||
reg_0_value = 57007; // decimal values of registers for testing
|
|
||||||
reg_1_value = 48879;
|
|
||||||
reg_2_value = 3790;
|
|
||||||
reg_3_value = 4613;
|
|
||||||
|
|
||||||
delay(5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void receiveEvent(int bytes) {
|
|
||||||
// Read the first byte to determine which register is concerned
|
|
||||||
reg = Wire.read();
|
|
||||||
Serial.print("Read register ");
|
|
||||||
Serial.println(reg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void requestEvent() {
|
|
||||||
// Read from the register variable to know what to send back
|
|
||||||
digitalWrite(LED_BUILTIN, HIGH);
|
|
||||||
if (reg == REGISTER_0) {
|
|
||||||
Wire.write((uint8_t *)®_0_value, sizeof(reg_0_value));
|
|
||||||
Serial.print("Writing value ");
|
|
||||||
Serial.println(reg_0_value, DEC); // writing register value in DECIMAL format
|
|
||||||
} else if (reg == REGISTER_1) {
|
|
||||||
Wire.write((uint8_t *)®_1_value, sizeof(reg_1_value));
|
|
||||||
Serial.print("Writing value ");
|
|
||||||
Serial.println(reg_1_value, DEC);
|
|
||||||
} else if (reg == REGISTER_2) {
|
|
||||||
Wire.write((uint8_t *)®_2_value, sizeof(reg_2_value));
|
|
||||||
Serial.print("Writing value ");
|
|
||||||
Serial.println(reg_2_value, DEC);
|
|
||||||
} else if (reg == REGISTER_3) {
|
|
||||||
Wire.write((uint8_t *)®_3_value, sizeof(reg_3_value));
|
|
||||||
Serial.print("Writing value ");
|
|
||||||
Serial.println(reg_3_value, DEC);
|
|
||||||
} else {
|
|
||||||
Serial.println("Unknown register");
|
|
||||||
}
|
|
||||||
delay(50);
|
|
||||||
digitalWrite(LED_BUILTIN, LOW);
|
|
||||||
}
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
#include <Wire.h>
|
|
||||||
#define REGISTER_0 0x00
|
|
||||||
#define REGISTER_1 0x01
|
|
||||||
#define REGISTER_2 0x02
|
|
||||||
#define REGISTER_3 0x03
|
|
||||||
#define I2C_ADDRESS_SELF 0x4B
|
|
||||||
|
|
||||||
unsigned int reg_0_value = 41151;
|
|
||||||
unsigned int reg_1_value = 0;
|
|
||||||
unsigned int reg_2_value = 0;
|
|
||||||
unsigned int reg_3_value = 0;
|
|
||||||
|
|
||||||
uint8_t master_reg; // I2C master read register
|
|
||||||
uint8_t slave_reg; // I2C slave read register
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Serial.begin(9600); //Begins Serial communication
|
|
||||||
Serial.println("Setup for sensor");
|
|
||||||
|
|
||||||
Wire.begin(I2C_ADDRESS_SELF); // join i2c bus
|
|
||||||
Wire.setClock(400000); // set I2C clock for full speed
|
|
||||||
Serial.begin(9600); // start serial for output
|
|
||||||
digitalWrite(A4, LOW);
|
|
||||||
digitalWrite(A5, LOW);
|
|
||||||
Wire.onRequest(requestEvent);
|
|
||||||
Wire.onReceive(receiveEvent);
|
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
|
||||||
Serial.println("Starting");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
Serial.println("Read sensor value");
|
|
||||||
|
|
||||||
reg_0_value = 1; // set register 0 value to the sensor value
|
|
||||||
reg_1_value += 1; // increment a count of how many values read
|
|
||||||
}
|
|
||||||
|
|
||||||
void receiveEvent(int bytes) {
|
|
||||||
// Slave reads the first byte to determine which register is concerned
|
|
||||||
slave_reg = Wire.read();
|
|
||||||
Serial.print("Slave read register ");
|
|
||||||
Serial.println(slave_reg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void requestEvent() {
|
|
||||||
// Slave uses the the register variable to know what to send back
|
|
||||||
digitalWrite(LED_BUILTIN, HIGH);
|
|
||||||
if (slave_reg == REGISTER_0) {
|
|
||||||
Wire.write((uint8_t *)®_0_value, sizeof(reg_0_value));
|
|
||||||
Serial.print("Slave writing value ");
|
|
||||||
Serial.println(reg_0_value);
|
|
||||||
} else if (slave_reg == REGISTER_1) {
|
|
||||||
Wire.write((uint8_t *)®_1_value, sizeof(reg_1_value));
|
|
||||||
Serial.print("Slave writing value ");
|
|
||||||
Serial.println(reg_1_value);
|
|
||||||
} else if (slave_reg == REGISTER_2) {
|
|
||||||
Wire.write((uint8_t *)®_2_value, sizeof(reg_2_value));
|
|
||||||
Serial.print("Slave writing value ");
|
|
||||||
Serial.println(reg_2_value);
|
|
||||||
} else if (slave_reg == REGISTER_3) {
|
|
||||||
Wire.write((uint8_t *)®_3_value, sizeof(reg_3_value));
|
|
||||||
Serial.print("Slave writing value ");
|
|
||||||
Serial.println(reg_3_value);
|
|
||||||
} else {
|
|
||||||
Serial.println("Slave unknown register");
|
|
||||||
}
|
|
||||||
delay(50);
|
|
||||||
digitalWrite(LED_BUILTIN, LOW);
|
|
||||||
}
|
|
||||||
@ -1,19 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo -e "\nDemo of CubeSatSim sends AFSK telemetry at 440 MHz continuously\n\n"
|
echo -e "\nDemo of CubeSatSim at 434.9 MHz\n"
|
||||||
|
|
||||||
sleep 30
|
#exit
|
||||||
|
|
||||||
#echo 'sleep over' >> /home/pi/CubeSatSim/log.txt
|
y=$(last reboot | grep ^reboot | wc -l)
|
||||||
|
echo $y
|
||||||
echo $(date '+%Y %b %d %H:%M') Starting Hostname $HOSTNAME >> /home/pi/CubeSatSim/log.txt
|
|
||||||
|
if (( $y % 2 == 0 ))
|
||||||
/home/pi/CubeSatSim/radioafsk >> /home/pi/CubeSatSim/log.txt
|
then
|
||||||
#/home/pi/DigitalTxRxRPi/testafsktx >> /home/pi/CubeSatSim/log.txt
|
echo -e "\n Continuous FSK Mode\n\n"
|
||||||
|
/home/pi/CubeSatSim/radioafsk f
|
||||||
echo $(date '+%Y %b %d %H:%M') Stopping Hostname $HOSTNAME >> /home/pi/CubeSatSim/log.txt
|
else
|
||||||
|
|
||||||
#/home/pi/mopower/mpcmd LED_STAT=0
|
echo -e "\n Alternating FSK, BPSK, and AFSK telemetry Mode \n\n"
|
||||||
#sleep 30
|
/home/pi/CubeSatSim/radioafsk afsk 5 y
|
||||||
|
while true; do
|
||||||
#/home/pi/CubeSatSim/configax
|
echo -e "\n Changing mode ******\n\n"
|
||||||
|
/home/pi/CubeSatSim/radioafsk fsk 5 n
|
||||||
|
/home/pi/CubeSatSim/radioafsk bpsk 5 n
|
||||||
|
# sleep 24
|
||||||
|
sleep 1
|
||||||
|
sudo killall -9 sendiq
|
||||||
|
sudo killall -9 sendiq
|
||||||
|
sleep 1
|
||||||
|
/home/pi/CubeSatSim/radioafsk afsk 5 n
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo -e "\nDemo of CubeSatSim sends AFSK telemetry at 434.9 MHz continuously\n\n"
|
||||||
|
|
||||||
|
#exit
|
||||||
|
|
||||||
|
sudo killall -9 rpitx
|
||||||
|
sudo killall -9 sendiq
|
||||||
|
sudo fuser -k 8080/tcp
|
||||||
|
|
||||||
|
/home/pi/CubeSatSim/radioafsk a 3
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo -e "\nDemo of CubeSatSim sends FSK, BPSK, and AFSK telemetry alternately at 434.9 MHz continuously\n\n"
|
||||||
|
|
||||||
|
sudo killall -9 rpitx
|
||||||
|
sudo killall -9 sendiq
|
||||||
|
sudo fuser -k 8080/tcp
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
sleep 1;
|
||||||
|
echo -e "\n Changing mode ********************************************************************************\n\n"
|
||||||
|
|
||||||
|
timeout 25 /home/pi/CubeSatSim/radioafsk c 3
|
||||||
|
sudo killall -9 rpitx
|
||||||
|
sudo killall -9 sendiq
|
||||||
|
sudo fuser -k 8080/tcp
|
||||||
|
done
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,5 @@
|
|||||||
|
20:51:55$ fm KU2Y-1 to CQ-1 UI PID=F0
|
||||||
|
hi hi 113 199 199 199 299 299 299 249 326 350 300 300 444 400 400 400 500 500 500 500 600 600 600 650
|
||||||
|
20:51:55$ fm KU2Y-1 to CQ-1 UI PID=F0
|
||||||
|
hi hi 114 199 199 199 299 299 299 249 326 350 300 300 444 400 400 400 500 500 500 500 600 600 600 650
|
||||||
|
|
||||||
Binary file not shown.
|
@ -0,0 +1,69 @@
|
|||||||
|
#Fox 1 Telemetry Decoder Properties
|
||||||
|
#Sat Oct 12 10:34:00 EST 2019
|
||||||
|
user_mode=4
|
||||||
|
foxId=99
|
||||||
|
IHU_SN=7
|
||||||
|
catalogNumber=0
|
||||||
|
model=1
|
||||||
|
mpptResistanceError=6.58
|
||||||
|
mpptSensorOffThreshold=1600
|
||||||
|
name=CubeSat Simulator BPSK
|
||||||
|
displayName=CubeSat Simulator BPSK
|
||||||
|
BATTERY_CURRENT_ZERO=-1.834
|
||||||
|
hasImprovedCommandReceiver=true
|
||||||
|
EXP1=6
|
||||||
|
EXP2=1
|
||||||
|
EXP3=8
|
||||||
|
EXP4=7
|
||||||
|
description=The AMSAT CubeSat Simulator is a functional model of a 1U CubeSat, for more info see http://cubesatsim.org
|
||||||
|
numberOfFrameLayouts=5
|
||||||
|
frameLayout0.filename=FOX1E_Type0_ALL_WOD.frame
|
||||||
|
frameLayout0.name=All WOD
|
||||||
|
frameLayout1.filename=FOX1E_Type1_HEALTH.frame
|
||||||
|
frameLayout1.name=Health
|
||||||
|
frameLayout2.filename=FOX1E_Type2_MINMAX.frame
|
||||||
|
frameLayout2.name=MinMax
|
||||||
|
frameLayout3.filename=FOX1E_Type3_REALTIME_BEACON.frame
|
||||||
|
frameLayout3.name=Realtime Beacon
|
||||||
|
frameLayout4.filename=FOX1E_Type4_WOD_BEACON.frame
|
||||||
|
frameLayout4.name=WOD Beacon
|
||||||
|
numberOfLayouts=9
|
||||||
|
layout0.filename=FOX1A_debug.csv
|
||||||
|
layout0.name=DEBUG
|
||||||
|
layout1.filename=FOX1E_maxtelemetry.csv
|
||||||
|
layout1.name=maxtelemetry
|
||||||
|
layout2.filename=FOX1E_rttelemetry.csv
|
||||||
|
layout2.name=rttelemetry
|
||||||
|
layout3.filename=FOX1E_mintelemetry.csv
|
||||||
|
layout3.name=mintelemetry
|
||||||
|
layout4.filename=FOX1E_radtelemetry.csv
|
||||||
|
layout4.name=radtelemetry
|
||||||
|
layout5.filename=FOX1E_radtelemetry2.csv
|
||||||
|
layout5.name=radtelemetry2
|
||||||
|
layout5.parentLayout=radtelemetry
|
||||||
|
layout6.filename=FOX1E_wodtelemetry.csv
|
||||||
|
layout6.name=wodtelemetry
|
||||||
|
layout7.filename=FOX1E_wodradtelemetry.csv
|
||||||
|
layout7.name=wodradtelemetry
|
||||||
|
layout8.filename=FOX1E_wodradtelemetry2.csv
|
||||||
|
layout8.name=wodradtelemetry2
|
||||||
|
layout8.parentLayout=wodradtelemetry
|
||||||
|
numberOfLookupTables=3
|
||||||
|
lookupTable0.filename=FOX1A_rssiFM.tab
|
||||||
|
lookupTable0=RSSI
|
||||||
|
lookupTable1.filename=FOX1E_ihuVBattSNx.tab
|
||||||
|
lookupTable1=IHU_VBATT
|
||||||
|
lookupTable2.filename=FOX1A_ihutempSN7.tab
|
||||||
|
lookupTable2=IHU_TEMP
|
||||||
|
maxFreqBoundkHz=434950
|
||||||
|
measurementsFileName=measurements.csv
|
||||||
|
memsRestValueX=2129
|
||||||
|
memsRestValueY=2131
|
||||||
|
memsRestValueZ=2103
|
||||||
|
minFreqBoundkHz=434850
|
||||||
|
passMeasurementsFileName=passmeasurements.csv
|
||||||
|
telemetryDownlinkFreqkHz=434900
|
||||||
|
track=false
|
||||||
|
useIHUVBatt=false
|
||||||
|
numberOfSources=1
|
||||||
|
source0.name=ihu.bpsk
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
#Fox 1 Telemetry Decoder Properties
|
||||||
|
#Sat Oct 12 10:35:00 EST 2019
|
||||||
|
#File named .dat should be in the logfiles directory and is loaded by FoxTelem
|
||||||
|
#File named .MASTER should not be edited and is a backup copy in the installation directory
|
||||||
|
foxId=7
|
||||||
|
displayName=CubeSat Simulator FSK
|
||||||
|
name=CubeSat Simulator FSK
|
||||||
|
model=1
|
||||||
|
IHU_SN=7
|
||||||
|
catalogNumber=0
|
||||||
|
description=The AMSAT CubeSat Simulator is a functional model of a 1U CubeSat, for more info see http://cubesatsim.org
|
||||||
|
BATTERY_CURRENT_ZERO=-1.839
|
||||||
|
EXP1=6
|
||||||
|
EXP2=1
|
||||||
|
EXP3=0
|
||||||
|
EXP4=0
|
||||||
|
numberOfLayouts=6
|
||||||
|
layout0.filename=FOX1A_debug.csv
|
||||||
|
layout0.name=DEBUG
|
||||||
|
layout1.filename=FOX1A_maxtelemetry.csv
|
||||||
|
layout1.name=maxtelemetry
|
||||||
|
layout2.filename=CubeSatSim_rttelemetryFM.csv
|
||||||
|
layout2.name=rttelemetry
|
||||||
|
layout3.filename=FOX1A_mintelemetry.csv
|
||||||
|
layout3.name=mintelemetry
|
||||||
|
layout4.filename=FOX1A_radtelemetry.csv
|
||||||
|
layout4.name=radtelemetry
|
||||||
|
layout5.filename=FOX1A_radtelemetry2.csv
|
||||||
|
layout5.name=radtelemetry2
|
||||||
|
layout5.parentLayout=radtelemetry
|
||||||
|
lookupTable0.filename=FOX1A_rssiFM.tab
|
||||||
|
numberOfLookupTables=3
|
||||||
|
lookupTable0=RSSI
|
||||||
|
lookupTable1.filename=FOX1A_ihuVBattSN7.tab
|
||||||
|
lookupTable1=IHU_VBATT
|
||||||
|
lookupTable2.filename=FOX1A_ihutempSN7.tab
|
||||||
|
lookupTable2=IHU_TEMP
|
||||||
|
telemetryDownlinkFreqkHz=434900
|
||||||
|
maxFreqBoundkHz=434950
|
||||||
|
minFreqBoundkHz=434850
|
||||||
|
measurementsFileName=measurements.csv
|
||||||
|
memsRestValueX=2087
|
||||||
|
memsRestValueY=2101
|
||||||
|
memsRestValueZ=2045
|
||||||
|
passMeasurementsFileName=passmeasurements.csv
|
||||||
|
numberOfSources=2
|
||||||
|
source0.name=ihu.duv
|
||||||
|
source1.name=ihu.highspeed
|
||||||
|
track=true
|
||||||
|
useIHUVBatt=true
|
||||||
|
user_mode=0
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
#Fox 1 Telemetry Decoder Properties
|
||||||
|
#Sat Sept 22 18:12:20 EST 2019
|
||||||
|
#File named .dat should be in the logfiles directory and is loaded by FoxTelem
|
||||||
|
#File named .MASTER should not be edited and is a backup copy in the installation directory
|
||||||
|
foxId=7
|
||||||
|
displayName=CubeSat Simulator DUV
|
||||||
|
name=CubeSat Simulator DUV
|
||||||
|
model=0
|
||||||
|
IHU_SN=7
|
||||||
|
catalogNumber=0
|
||||||
|
description=CubeSat Simulator is a functional satellite model that generates real telemetry from solar panels, batteries, and temperature sensors. Use this for DUV FSK telemetry. For more information see http://cubesatsim.org
|
||||||
|
BATTERY_CURRENT_ZERO=-1.839
|
||||||
|
EXP1=0
|
||||||
|
EXP2=0
|
||||||
|
EXP3=0
|
||||||
|
EXP4=0
|
||||||
|
numberOfLayouts=4
|
||||||
|
layout0.filename=FOX1A_debug.csv
|
||||||
|
layout0.name=DEBUG
|
||||||
|
layout1.filename=FOX1A_maxtelemetry.csv
|
||||||
|
layout1.name=maxtelemetry
|
||||||
|
layout2.filename=CubeSatSim_rttelemetryFM.csv
|
||||||
|
layout2.name=rttelemetry
|
||||||
|
layout3.filename=FOX1A_mintelemetry.csv
|
||||||
|
layout3.name=mintelemetry
|
||||||
|
#layout4.filename=FOX1A_radtelemetry.csv
|
||||||
|
#layout4.name=radtelemetry
|
||||||
|
#layout5.filename=FOX1A_radtelemetry2.csv
|
||||||
|
#layout5.name=radtelemetry2
|
||||||
|
#layout5.parentLayout=radtelemetry
|
||||||
|
lookupTable0.filename=FOX1A_rssiFM.tab
|
||||||
|
numberOfLookupTables=3
|
||||||
|
lookupTable0=RSSI
|
||||||
|
lookupTable1.filename=FOX1A_ihuVBattSN7.tab
|
||||||
|
lookupTable1=IHU_VBATT
|
||||||
|
lookupTable2.filename=FOX1A_ihutempSN7.tab
|
||||||
|
lookupTable2=IHU_TEMP
|
||||||
|
telemetryDownlinkFreqkHz=434900
|
||||||
|
maxFreqBoundkHz=434950
|
||||||
|
minFreqBoundkHz=434850
|
||||||
|
measurementsFileName=measurements.csv
|
||||||
|
memsRestValueX=2087
|
||||||
|
memsRestValueY=2101
|
||||||
|
memsRestValueZ=2045
|
||||||
|
passMeasurementsFileName=passmeasurements.csv
|
||||||
|
numberOfSources=1
|
||||||
|
source0.name=ihu.duv
|
||||||
|
#source1.name=ihu.highspeed
|
||||||
|
track=true
|
||||||
|
useIHUVBatt=true
|
||||||
|
user_mode=0
|
||||||
|
user_format=0
|
||||||
|
useConversionCoeffs=true
|
||||||
|
conversionCurvesFileName=cubesatsim_conversion_curves.csv
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
#Fox 1 Telemetry Decoder Properties
|
||||||
|
#Thu Feb 09 21:13:22 EST 2017
|
||||||
|
user_mode=4
|
||||||
|
foxId=99
|
||||||
|
IHU_SN=7
|
||||||
|
catalogNumber=0
|
||||||
|
model=1
|
||||||
|
mpptResistanceError=6.58
|
||||||
|
mpptSensorOffThreshold=1600
|
||||||
|
name=CubeSat Simulator PSK
|
||||||
|
displayName=CubeSat Simulator PSK
|
||||||
|
BATTERY_CURRENT_ZERO=-1.834
|
||||||
|
hasImprovedCommandReceiver=true
|
||||||
|
EXP1=6
|
||||||
|
EXP2=1
|
||||||
|
EXP3=8
|
||||||
|
EXP4=7
|
||||||
|
description=CubeSat Simulator is a functional satellite model that generates real telemetry from solar panels, batteries, and temperature sensors. Use this for BPSK telemetry. For more information see http://cubesatsim.org
|
||||||
|
numberOfFrameLayouts=5
|
||||||
|
frameLayout0.filename=FOX1E_Type0_ALL_WOD.frame
|
||||||
|
frameLayout0.name=All WOD
|
||||||
|
frameLayout1.filename=FOX1E_Type1_HEALTH.frame
|
||||||
|
frameLayout1.name=Health
|
||||||
|
frameLayout2.filename=FOX1E_Type2_MINMAX.frame
|
||||||
|
frameLayout2.name=MinMax
|
||||||
|
frameLayout3.filename=FOX1E_Type3_REALTIME_BEACON.frame
|
||||||
|
frameLayout3.name=Realtime Beacon
|
||||||
|
frameLayout4.filename=FOX1E_Type4_WOD_BEACON.frame
|
||||||
|
frameLayout4.name=WOD Beacon
|
||||||
|
numberOfLayouts=9
|
||||||
|
layout0.filename=FOX1A_debug.csv
|
||||||
|
layout0.name=DEBUG
|
||||||
|
layout1.filename=FOX1E_maxtelemetry.csv
|
||||||
|
layout1.name=maxtelemetry
|
||||||
|
layout2.filename=cubesatsim_psk_rttelemetry.csv
|
||||||
|
layout2.name=rttelemetry
|
||||||
|
layout3.filename=FOX1E_mintelemetry.csv
|
||||||
|
layout3.name=mintelemetry
|
||||||
|
layout4.filename=FOX1E_radtelemetry.csv
|
||||||
|
layout4.name=radtelemetry
|
||||||
|
layout5.filename=FOX1E_radtelemetry2.csv
|
||||||
|
layout5.name=radtelemetry2
|
||||||
|
layout5.parentLayout=radtelemetry
|
||||||
|
layout6.filename=FOX1E_wodtelemetry.csv
|
||||||
|
layout6.name=wodtelemetry
|
||||||
|
layout7.filename=FOX1E_wodradtelemetry.csv
|
||||||
|
layout7.name=wodradtelemetry
|
||||||
|
layout8.filename=FOX1E_wodradtelemetry2.csv
|
||||||
|
layout8.name=wodradtelemetry2
|
||||||
|
layout8.parentLayout=wodradtelemetry
|
||||||
|
numberOfLookupTables=3
|
||||||
|
lookupTable0.filename=FOX1A_rssiFM.tab
|
||||||
|
lookupTable0=RSSI
|
||||||
|
lookupTable1.filename=FOX1E_ihuVBattSNx.tab
|
||||||
|
lookupTable1=IHU_VBATT
|
||||||
|
lookupTable2.filename=FOX1A_ihutempSN7.tab
|
||||||
|
lookupTable2=IHU_TEMP
|
||||||
|
maxFreqBoundkHz=434950
|
||||||
|
measurementsFileName=measurements.csv
|
||||||
|
memsRestValueX=2129
|
||||||
|
memsRestValueY=2131
|
||||||
|
memsRestValueZ=2103
|
||||||
|
minFreqBoundkHz=434850
|
||||||
|
passMeasurementsFileName=passmeasurements.csv
|
||||||
|
telemetryDownlinkFreqkHz=434900
|
||||||
|
track=false
|
||||||
|
useIHUVBatt=false
|
||||||
|
numberOfSources=1
|
||||||
|
source0.name=ihu.bpsk
|
||||||
|
user_format=0
|
||||||
|
useConversionCoeffs=true
|
||||||
|
conversionCurvesFileName=cubesatsim_conversion_curves.csv
|
||||||
@ -0,0 +1 @@
|
|||||||
|
These files are for FoxTelem version 1.09f in the spacecraft directory
|
||||||
|
|
@ -0,0 +1,72 @@
|
|||||||
|
#Fox 1 Telemetry Decoder Properties
|
||||||
|
#Thu Apr 11 13:23:23 EST 2020
|
||||||
|
user_mode=4
|
||||||
|
foxId=99
|
||||||
|
IHU_SN=7
|
||||||
|
catalogNumber=0
|
||||||
|
model=1
|
||||||
|
mpptResistanceError=6.58
|
||||||
|
mpptSensorOffThreshold=1600
|
||||||
|
name=CubeSatSim
|
||||||
|
displayName=CubeSatSim-BPSK
|
||||||
|
BATTERY_CURRENT_ZERO=-1.834
|
||||||
|
hasImprovedCommandReceiver=true
|
||||||
|
EXP1=6
|
||||||
|
EXP2=1
|
||||||
|
EXP3=8
|
||||||
|
EXP4=7
|
||||||
|
description=CubeSatSim, the AMSAT CubeSat Simulator, is a functional satellite model that generates real telemetry from solar panels, batteries, and temperature sensors. Use this for BPSK telemetry. For more information see http://cubesatsim.org
|
||||||
|
numberOfFrameLayouts=5
|
||||||
|
frameLayout0.filename=FOX1E_Type0_ALL_WOD.frame
|
||||||
|
frameLayout0.name=All WOD
|
||||||
|
frameLayout1.filename=FOX1E_Type1_HEALTH.frame
|
||||||
|
frameLayout1.name=Health
|
||||||
|
frameLayout2.filename=FOX1E_Type2_MINMAX.frame
|
||||||
|
frameLayout2.name=MinMax
|
||||||
|
frameLayout3.filename=FOX1E_Type3_REALTIME_BEACON.frame
|
||||||
|
frameLayout3.name=Realtime Beacon
|
||||||
|
frameLayout4.filename=FOX1E_Type4_WOD_BEACON.frame
|
||||||
|
frameLayout4.name=WOD Beacon
|
||||||
|
numberOfLayouts=9
|
||||||
|
layout0.filename=FOX1A_debug.csv
|
||||||
|
layout0.name=DEBUG
|
||||||
|
layout1.filename=FOX1E_maxtelemetry.csv
|
||||||
|
layout1.name=maxtelemetry
|
||||||
|
layout2.filename=cubesatsim_psk_rttelemetry.csv
|
||||||
|
layout2.name=rttelemetry
|
||||||
|
layout3.filename=FOX1E_mintelemetry.csv
|
||||||
|
layout3.name=mintelemetry
|
||||||
|
layout4.filename=FOX1E_radtelemetry.csv
|
||||||
|
layout4.name=radtelemetry
|
||||||
|
layout5.filename=FOX1E_radtelemetry2.csv
|
||||||
|
layout5.name=radtelemetry2
|
||||||
|
layout5.parentLayout=radtelemetry
|
||||||
|
layout6.filename=FOX1E_wodtelemetry.csv
|
||||||
|
layout6.name=wodtelemetry
|
||||||
|
layout7.filename=FOX1E_wodradtelemetry.csv
|
||||||
|
layout7.name=wodradtelemetry
|
||||||
|
layout8.filename=FOX1E_wodradtelemetry2.csv
|
||||||
|
layout8.name=wodradtelemetry2
|
||||||
|
layout8.parentLayout=wodradtelemetry
|
||||||
|
numberOfLookupTables=3
|
||||||
|
lookupTable0.filename=FOX1A_rssiFM.tab
|
||||||
|
lookupTable0=RSSI
|
||||||
|
lookupTable1.filename=FOX1E_ihuVBattSNx.tab
|
||||||
|
lookupTable1=IHU_VBATT
|
||||||
|
lookupTable2.filename=FOX1A_ihutempSN7.tab
|
||||||
|
lookupTable2=IHU_TEMP
|
||||||
|
maxFreqBoundkHz=434950
|
||||||
|
measurementsFileName=measurements.csv
|
||||||
|
memsRestValueX=2129
|
||||||
|
memsRestValueY=2131
|
||||||
|
memsRestValueZ=2103
|
||||||
|
minFreqBoundkHz=434850
|
||||||
|
passMeasurementsFileName=passmeasurements.csv
|
||||||
|
telemetryDownlinkFreqkHz=434900
|
||||||
|
track=false
|
||||||
|
useIHUVBatt=false
|
||||||
|
numberOfSources=1
|
||||||
|
source0.name=ihu.bpsk
|
||||||
|
user_format=0
|
||||||
|
useConversionCoeffs=true
|
||||||
|
conversionCurvesFileName=cubesatsim_conversion_curves.csv
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
#Fox 1 Telemetry Decoder Properties
|
||||||
|
#Sat Apr 11 13:20:20 EST 2020
|
||||||
|
#File named .dat should be in the logfiles directory and is loaded by FoxTelem
|
||||||
|
#File named .MASTER should not be edited and is a backup copy in the installation directory
|
||||||
|
foxId=7
|
||||||
|
displayName=CubeSatSim-FSK
|
||||||
|
name=CubeSatSim
|
||||||
|
model=0
|
||||||
|
IHU_SN=7
|
||||||
|
catalogNumber=0
|
||||||
|
description=CubeSatSim, the AMSAT CubeSat Simulator, is a functional satellite model that generates real telemetry from solar panels, batteries, and temperature sensors. Use this for DUV FSK telemetry. For more information see http://cubesatsim.org
|
||||||
|
BATTERY_CURRENT_ZERO=-1.839
|
||||||
|
EXP1=0
|
||||||
|
EXP2=0
|
||||||
|
EXP3=0
|
||||||
|
EXP4=0
|
||||||
|
numberOfLayouts=4
|
||||||
|
layout0.filename=FOX1A_debug.csv
|
||||||
|
layout0.name=DEBUG
|
||||||
|
layout1.filename=FOX1A_maxtelemetry.csv
|
||||||
|
layout1.name=maxtelemetry
|
||||||
|
layout2.filename=CubeSatSim_rttelemetryFM.csv
|
||||||
|
layout2.name=rttelemetry
|
||||||
|
layout3.filename=FOX1A_mintelemetry.csv
|
||||||
|
layout3.name=mintelemetry
|
||||||
|
#layout4.filename=FOX1A_radtelemetry.csv
|
||||||
|
#layout4.name=radtelemetry
|
||||||
|
#layout5.filename=FOX1A_radtelemetry2.csv
|
||||||
|
#layout5.name=radtelemetry2
|
||||||
|
#layout5.parentLayout=radtelemetry
|
||||||
|
lookupTable0.filename=FOX1A_rssiFM.tab
|
||||||
|
numberOfLookupTables=3
|
||||||
|
lookupTable0=RSSI
|
||||||
|
lookupTable1.filename=FOX1A_ihuVBattSN7.tab
|
||||||
|
lookupTable1=IHU_VBATT
|
||||||
|
lookupTable2.filename=FOX1A_ihutempSN7.tab
|
||||||
|
lookupTable2=IHU_TEMP
|
||||||
|
telemetryDownlinkFreqkHz=434900
|
||||||
|
maxFreqBoundkHz=434950
|
||||||
|
minFreqBoundkHz=434850
|
||||||
|
measurementsFileName=measurements.csv
|
||||||
|
memsRestValueX=2087
|
||||||
|
memsRestValueY=2101
|
||||||
|
memsRestValueZ=2045
|
||||||
|
passMeasurementsFileName=passmeasurements.csv
|
||||||
|
numberOfSources=1
|
||||||
|
source0.name=ihu.duv
|
||||||
|
#source1.name=ihu.highspeed
|
||||||
|
track=true
|
||||||
|
useIHUVBatt=true
|
||||||
|
user_mode=0
|
||||||
|
user_format=0
|
||||||
|
useConversionCoeffs=true
|
||||||
|
conversionCurvesFileName=cubesatsim_conversion_curves.csv
|
||||||
|
Binary file not shown.
|
|
@ -0,0 +1,9 @@
|
|||||||
|
These files are for FoxTelem, the AMSAT software by Chris Thompson AC3CZ/G0KLA for decoding and displaying Fox-1 series CubeSat telemetry.
|
||||||
|
|
||||||
|
To use FoxTelem with the CubeSat Simulator, you will need to download the latest version number listed in this directory.
|
||||||
|
|
||||||
|
https://www.g0kla.com/foxtelem/downloads/test/
|
||||||
|
|
||||||
|
Next, download the .MASTER files in the correct version number directory and put them in the FoxTelem spacecraft folder.
|
||||||
|
|
||||||
|
Run FoxTelem, then go under Spacecraft/Add and select the .MASTER files to add the CubeSat Simulator to FoxTelem.
|
||||||
Loading…
Reference in new issue