Hi Shubham I am just using this to test PYLD code
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE by
DefinitionsAndGlobals.h
00001 // **************DEFINITIONS********************* 00002 00003 #define bypass_adf 1 00004 00005 // COM_RX 00006 #define RX_TIMEOUT_LIMIT 0.5 00007 //#define COM_RX_UART_TX PTE20 // For bypassing RX1M (SET BAUD RATE 1200) #define COM_RX_UART_TX USBTX 00008 //#define COM_RX_UART_RX PTE21 // For bypassing RX1M (SET BAUD RATE 1200) #define COM_RX_UART_RX USBRX 00009 00010 #define COM_RX_UART_TX USBTX 00011 #define COM_RX_UART_RX USBRX 00012 00013 // COMMON SPI 00014 #define SPI_MOSI PTE1 00015 #define SPI_MISO PTE3 00016 #define SPI_CLK PTE2 00017 #define SPI_CS_ADF PTA15 00018 #define SPI_CS_SDC PIN20 00019 #define SPI_CS_RTC PIN26 00020 00021 // COM_TX 00022 #define COM_TX_CONFIG_LIMIT 3 00023 #define COM_TX_TICKER_LIMIT 32 00024 00025 // ADF INTERRUPUT 00026 #define ADF_IRQ PTA14 00027 00028 // TC LIST 00029 #define TCL_STATE_INCOMPLETE 0x00 00030 #define TCL_STATE_ABORTED 0x03 00031 #define TCL_STATE_EXECUTING 0x04 00032 #define TCL_STATE_COMPLETED 0x05 00033 #define TCL_STATE_EXCEEDED_LIMIT 0x06 00034 00035 // LIST OF FLAGS 00036 #define UART_INT_FLAG 0x0001 00037 #define NEW_TC_RECEIVED 0x0002 00038 #define COM_SESSION_FLAG 0x0004 00039 #define COM_RX_FLAG 0x0008 00040 #define COM_MNG_TMTC_RUNNING_FLAG 0x0010 00041 #define COM_SESSION_VALIDITY 0x0020 00042 #define ALL_CRC_PASS_FLAG 0x0040 00043 #define COM_PA_HOT_FLAG 0x0080 00044 #define COM_TX_FLAG 0x0100 00045 #define COM_SESSION_TIMEOUT_FLAG 0x0200 00046 00047 // COM_MNG_TMTC THREAD 00048 #define SESSION_TIME_LIMIT 1500 00049 #define COM_MNG_TMTC_SIGNAL_UART_INT 0x01 00050 #define COM_MNG_TMTC_SIGNAL_ADF_NSD 0x02 00051 #define COM_MNG_TMTC_SIGNAL_ADF_SD 0x03 00052 #define SCIENCE_SIGNAL 0x04 00053 // COM_MNG_TMTC 00054 #define COM_PA_COOLING_TIME_LIMIT 20 00055 #define COM_MAX_TC_LIMIT 200 00056 #define TM_ACK_CODE_INDEX 2 00057 #define CRC_FAIL_NACK_CODE 0x01 00058 00059 // call sign 00060 #define PSC_CALLSIGN 0x00 00061 #define APID_CALLSIGN 0x00 00062 00063 // max value of telecommands in a tcl 00064 #define TCL_OVERFLOW_CONSTANT 256 00065 #define TM_OVERFLOW_CONSTANT 256 00066 00067 // starting value of packet sequence count at each pass 00068 #define PSC_START_VALUE 1 00069 00070 // APID list 00071 #define APID_COM 0 00072 #define APID_BAE 1 00073 #define APID_CDMS 2 00074 #define APID_SPEED 3 00075 00076 //SERVICE 00077 #define SERVICE_OBOSC 0xB 00078 #define SERVICE_OBSRS 0xF 00079 00080 // HIGH PRIORITY TC - priority list 00081 // not correct values here 00082 #define HPTC1 5 00083 #define HPTC2 6 00084 // Add more entries above 00085 00086 // SIZE of tc in bytes 00087 #define TC_SHORT_SIZE 11 00088 #define TC_LONG_SIZE 135 00089 00090 // TMID list 00091 #define TMID_ACK_L1 0xA 00092 #define TMID_ACK_L234 0xB 00093 #define TMID_TCL 0x7 00094 #define TMID_CALL_SIGN 0xE 00095 00096 // OBOSC SERVICE SUBTYPE 00097 #define OBOSC_TCL_MAX_SHORT_SIZE 11 00098 #define OBOSC_LONG_TC_FIRST_HALF_SIZE 67 00099 #define OBOSC_LONG_TC_SECOND_HALF_SIZE 68 00100 #define OBOSC_TCL_TAG_LONG_FIRST_HALF 0x10 00101 #define OBOSC_TCL_TAG_LONG_SECOND_HALF 0x11 00102 00103 #define OBOSC_SUB_DISABLE 0x01 00104 #define OBOSC_SUB_RETRY 0x05 00105 #define OBOSC_SUB_REP_TCLD 0x06 00106 #define OBOSC_SUB_REP_LE 0x0F 00107 #define OBOSC_SUB_RESET 0x07 00108 00109 // PAYLOAD or SCIENCE 00110 #define PAYLOAD_BUFFER_LENGTH 6723 00111 #define PAY_SPI_MOSI PTE18 00112 #define PAY_SPI_MISO PTE19 00113 #define PAY_SPI_CLK PTE17 00114 #define PAY_SPI_CS PTE16 00115 00116 00117 // ****************GLOBAL VARIABLES****************** 00118 // DEBUG 00119 Serial gPC( USBTX, USBRX ); 00120 DigitalOut gLEDR(LED_RED); 00121 DigitalOut gLEDG(LED_GREEN); 00122 00123 // COM_RX 00124 RawSerial RX1M( COM_RX_UART_TX, COM_RX_UART_RX ); 00125 COM_RX_DATA_NODE *gRX_HEAD_DATA_NODE = NULL; 00126 COM_RX_DATA_NODE *gRX_CURRENT_DATA_NODE = NULL; 00127 // uint8_t *gRX_CURRENT_PTR = NULL; 00128 uint32_t gRX_COUNT = 0; 00129 uint16_t gTOTAL_INCORRECT_SIZE_TC = 0x00; 00130 uint16_t gTOTAL_CRC_FAIL_TC = 0x00; 00131 uint16_t gTOTAL_REPEATED_TC = 0x00; 00132 00133 // COMMON SPI 00134 SPI spi( SPI_MOSI, SPI_MISO, SPI_CLK ); 00135 DigitalOut gCS_ADF(SPI_CS_ADF); 00136 DigitalOut cs_sd(SPI_CS_SDC); 00137 DigitalOut gCS_RTC(SPI_CS_RTC); 00138 Mutex SPI_mutex; 00139 00140 // TC LIST 00141 Base_tc* gHEAD_NODE_TCL = NULL; 00142 Base_tc* gLAST_NODE_TCL = NULL; 00143 uint8_t gMASTER_STATE = TCL_STATE_INCOMPLETE; 00144 uint16_t gFLAGS = 0x0000; 00145 00146 // COM_MNG_TMTC THREAD 00147 Thread* gCOM_MNG_TMTC_THREAD = NULL; 00148 Timeout gRX_TIMEOUT; 00149 Timeout gSESSION_TIMEOUT; 00150 00151 // COM_MNG_TMTC 00152 00153 // PA cooling timeout 00154 Timeout gCOM_PA_COOLING_TIMEOUT; 00155 00156 // GS code for verification 00157 const uint8_t gGSCODE[] = {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 00158 00159 uint8_t gTOTAL_VALID_TC = 0x00; 00160 // USE LAST_L1_ACK FOR GENERATING REPORT 00161 uint8_t gLAST_TM[TM_LONG_SIZE]; 00162 uint8_t gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE; 00163 00164 // PAYLOAD OR SCIENCE_THREAD 00165 Thread* gSCIENCE_THREAD = NULL; 00166 dmaSPISlave gPAY_SPI(PAY_SPI_MOSI, PAY_SPI_MISO, PAY_SPI_CLK, PAY_SPI_CS); 00167 uint8_t gPAYLOAD_BUFFER[PAYLOAD_BUFFER_LENGTH]; 00168 00169 // CALL SIGN TM 00170 const uint8_t gCALL_SIGN_STRING[TM_SHORT_SIZE] = {0xE0, 0x00, 0x00, 0x00, 0x56, 0x55, 0x32, 0x4E, 0x43, 0x46, 0x00, 0xAC, 0x11}; 00171 00172 // CDMS HK 00173 CDMS_HK_actual actual_data; 00174 CDMS_HK_quant quant_data; 00175 CDMS_HK_min_max min_max_data; 00176 bool firstCount=true;
Generated on Wed Jul 13 2022 02:12:45 by 1.7.2