-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate EPS subsystem and commands via UART #40
Conversation
|
||
// #pragma region Function_Prototypes | ||
|
||
uint8_t eps_send_cmd_get_response(const uint8_t cmd_buf[], uint8_t cmd_buf_len, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace EPS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to check nested namespaces in functions / variables, like EPS_debug -> EPS_DEBUG (?) or UART_eps -> UART_EPS (?).
Suggest eps_telecommands.c -> telecommands_eps.c to unify file naming.
Compiles and flashes using my mac. I get this error when running eps_watchdog() telecommand:
UTC=2024-06-13T01:37:45.741502: Received telecommand (len=19): 'CTS1+eps_watchdog()'
======= Telecommand ======
Received telecommand 'eps_watchdog'
OBC->EPS (no tags): 0x1a 0x07 0x06 0x00
OBC->EPS (with tags): 0x3c 0x63 0x6d 0x64 0x3e 0x1a 0x07 0x06 0x00 0x3c 0x2f 0x63 0x6d 0x64 0x3e
OBC -> EPS TIMEOUT ERROR: HAL_GetTick() - UART_eps_last_write_time_ms > EPS_RX_TIMEOUT_MS
EPS->OBC (with tags):
OBC -> EPS ERROUTC=2024-06-13T01:37:45.798406: R: UART_eps_buffer_write_idx == 0
======== Response ========
EPS watchdog trigger failed (err 3)
==========================
I figure that error is telling me that I don't have an EPS system attached to the dev kit :) |
e4b0663
to
dc9ba10
Compare
Error message is clearer:
|
1f3dfb7
to
d5b252c
Compare
13edf46
to
7e18feb
Compare
cc3d44f
to
95a4f25
Compare
d68c07d
to
f1ad93d
Compare
@robotoshi, do you think you could plan to help with testing this one? |
Yeah I'll take a look |
f1ad93d
to
378b24e
Compare
378b24e
to
f474a26
Compare
@JohnathanBurchill, if you have any capacity to give this a quick glance, would love any feedback/sanity check you're able to provide this week before we merge it. No worries if you're tight on time though! |
Going to merge this now as other projects (e.g., #19) are depending on the UART setup in this PR. Super open to any feedback anyone has if they get a chance to review :) |
* IOC Update: Enable UART RX Interrupts, switch UART4 (Camera) to DMA * Antenna deployment drivers (#184) * All functions specified in the user manual for the antenna deployment system have been added * Telecommands for calling these functions have been implemented * Integrate EPS subsystem and commands via UART (#40) * Setup EPS UART interrupt handler * Copy semi-working EPS driver from EPS dev repo * Add watchdog EPS telecommand * Add eps_get_system_status_json command * Shorten "running_average" to "run_avg" * Remove `raw` functions * Implement non-result, non-argument EPS telecomands * Create tested `EPS_channel_from_str` function * Clean up argument naming conventions * Simplify eps_switch_to_mode command * Create `EPS_set_channel_enabled` function * Register telecommands for testing * Migrate EPS docs notes from other repo * Change MPI UART handler to use UART_mpi_port_handle * Rename `EPS_result_` to `EPS_struct_` * Create remaining to-json functions (housekeeping) * Create housekeeping tcmds, docstrings, register in command table * Bug Fix: swapped Apply Before Flight codes * Bug Fix: latest received byte time race condition with UART ISR * Increase output buffer size to 2048 bytes * Fix uint16 to int16 data types * Fix max transmission length * Update eps switch to mode docs * Update 5V MPI channel name, channel enabled message * ADCS Firmware (#151) * Migrate ADCSFirmware to VSCode * add more functions Changed .ioc file for easier testing * more functions * minor bugfix * more functions, again * more functions, again again * minor bugfix * add code for debugging hardware * comment changes for todo * minor change * prepare for unit tests * finish first unit test * minor bugfix * create first test telecommand * begin updating functions for unit testing * packer functions for extant TLMs * add more unit tests * more unit testing refactoring * Create number comparisons file * unit testing continued * unit tests * ADCS Firmware (#73) Bugfixes, unit tests, refactoring, and returns * Complete all functions from Commissioning Manual Next steps: unit tests, bugfixes, and CTS1 telecommands * minor type change to remove pointer signedness warnings uint8_t from telecommands was different from char in the helper functions * Add telecommand ASCII to double functions * Create number comparisons file * minor type change to remove pointer signedness warnings uint8_t from telecommands was different from char in the helper functions * Add telecommand ASCII to double functions * Create number comparisons file * minor type change to remove pointer signedness warnings uint8_t from telecommands was different from char in the helper functions * Add telecommand ASCII to double functions * start work on telecommands * More telecommands * adcs_types docstrings They're not much, but they should be sufficient once paired with the title of each function. (I can write more on them later if needed.) * Telecommand docstrings The telemetry docstrings aren't much, but they should be pretty much self-evident. * More telecommands * fix a telecommand * TLM Command bugfixes * comments and docstring updates * more unit tests * More unit tests * Finish the packer unit tests Unit tests are finished, and they all pass! * Update docstrings * Create TCMD_extract_int64_arg function * Fix issues from rebase * type mismatch in extract_uint64_arg * telecommand bugfix * Set up telecommand definitions * Fix warnings, and add another telecommand * fix number * more telecommands * Another telecommand * fix warnings * Yet another telecommand * Last telecommand from commissioning manual * fix warnings and remove resolved todos * minor changes and bugfix * Update command/telemetry IDs for clarity * Replace defines with static consts * Reorganise ADCS folders * Finish reorganisation * Add timeouts to internal drivers * Renames * More renames * Change struct doubles to ints in engineering notation (note: 5 unit tests still fail here -- to be fixed in next commit) * fix failing unit tests * unit test bugfixes * Create struct to JSON functions * Implement JSON data downlinks into telecommands * Provide static length for JSON floats * Begin fixing min string lengths * Estimates for min string lengths * Remove old ADCS UART functions Functions kept in nadeem-old-adcs-uart branch * Rename switch_order functions * Make types static * bugfix * bitmasks and standardisation * Create generic ADCS telecommands * minor change to pass test * improve generic telecommands * Format changes * Replace tabs with spaces for indentation * Lowercase _i2c_ in function names * Replace milli_deg with mdeg in variables * Improve readability * Command bugfixes * Increase telecommand buffer size * more format changes * additional format changes * fix outstanding TODOs * Update adcs header include paths * IOC Update: Add OBC Rev1.3 pin updates (#189) * Update IOC pin list to OBC Rev 1.3 * Regenerate code * Regenerate IOC pin list documentation Main changes: ``` Update Label: PA4.GPIO_Label=PIN_BOOM_PGOOD_IN Add new GPIO input pin: PB14.GPIO_Label=PIN_REMOVE_BEFORE_FLIGHT_LOW_IS_FLYING_IN ``` * Fix timekeeping format bug (#180), update format to `sync+offset_source` for better sorting (#187) * Fixed the timekeeping bug, where the first part of timestamps should be the unix timestamp of the last sync, but was displaying the current unix timestamp, per the documentation. * Updated the format to be `sync+offset` instead of having the source in the middle of the `sync+offset` string. * Updated the docs to the new re-ordered format. * Initialise ADCS CRC8 in main (#191) Update main.c * Antenna deploy temp conversion (#188) * Added function for converting temperature to centi degrees celsius * Appropriate unit tests added * ant_measure_temp telecommand now converts raw temp measurements using the newly added function * Create API which can read, write, and erase the internal flash memory (#174) * Initial internal flash bank api * Initial internal flash bank telecommands * Update internal flash API, add telecommands * Update readiness level to ground useage only * Add comment for flash partition enum * add erase params to telecommand * print out data in hex * accept arbitrary number of bytes * Update comments for telecommands * verify partitions, update comment * Remove comments * update include pathing * update include paths * Update comments for internal flash memory functions * rename functions to match standard * Rename files to stm32_internal_flash * Update Flash memory region address enum names * clean up write function, update docs, remove dead lines, update return * update read function, remove unnecessary address condition, update doc * update docs for function, clean up error handling for erase * slight doc update * remove unnecessary null terminator addition * update comments and return types * give status default value * add comma, update section header * Update internal flash tcmds to take starting address * Update contributers list * update function names * update return on writing to flash * Update docs, return explicit codes for writing to flash * Update erase function returns * add casting to fix warnings * Update function names to follow naming guidelines * rename folders and files * update includes and define guards * update comments, update function names * rename functions to captalize stm * Use struct to track errors in writing to flash * Update comment * Add include * Update Deployment Final Check * EPS: Simplify EPS struct packers with tight byte packing (#196) * Enable heartbeat LED on General Purpose LED 2 for OBC bring-up * Add TASK_heartbeat_period_ms config variable * Tiny docs clarification * Add boot-up LED flash and pre-RTOS init message * Minor documentation changes (#202) * ADCS Attribution and format changes * Functions are lowercase after namespace * Attribution given to code from ADCS Firmware Reference Manual * Ensure comments have space after // * minor bugfix * Remove extra EPS_PBU battery pack JSON array elements (#205) * Remove extra battery pack JSON fields * Fix type error * Implement thread to trigger eps watchdog (#201) * Implement thread to trigger eps watchdog * Find+Replace "trigger_eps_watchdog" to "service_eps_watchdog" * Restructure comments, error log, service period --------- Co-authored-by: DeflateAwning <[email protected]> * EPS: Add startup delay to EPS watchdog thread * Antenna deploy: use both I2C lines (#199) Allow antenna deploy functions to use both i2c channels * ant commands modified to to take i2c bus as parameter * telecommands which use ant commands have been updated to comply * Updated flash driver and littlefs helper to use NAND memory module (MT29F1G Series) (#177) * Replaced all flash driver code for NAND chip Replaced all previous code for FLASH driver for NAND flash module. * Updated memory module configuration Updated littlefs_helper.c configuration to use NAND memory module configuration values * Changes to flash_driver and flash_telecommand_defs Made changes to flash to handle full page reading and writing, added flash telecommand that unblocks block locks. * Minor changes to flash telecommands Minor changes to flash read hex telecommand for testing, added docstring for FLASH_reset function and telecommand. * Cleaned code from testing Removed all debugging printing lines to prepare for merging. Added new timeout variable for handling HAL_SPI transmits of 2176 bytes. * Removed Unblock_block_lock telecommand, Removed the telecommand unblock_block_locks and added automatic execution during write functions, minor changes to other flash telecommands. * Update LFS_benchmark_write_read to write many files * Fixed improper page addressing issue Fixed issue with improper page addressing where littlefs sent page address in bytes rather than the actual page address. * Minor changes based on PR review Removed unnecessary lines of code and added additional helpful comments based on PR comments * Updated littlefs benchmark test function Updated the littlefs benchmark write & read function to test both writing to the same file and to a new file. * Minor changes to fs benchmark file * Update littlefs_benchmark.c Added additional parameter in benchmark docstring. * Updated FLASH_MAX_BYTES_PER_PAGE Updated the naming and usage of variable FLASH_MAX_BYTES_PER_PAGE that keeps track of the maximum bytes per page for the FLASH NAND module. * Update flash_driver.h * Updated LFS_benchmark_write_read Updated name of LFS_benchmark_write_read_enum_t and added else statement for mode within function. --------- Co-authored-by: Saksham Puri <[email protected]> Co-authored-by: parker-research <[email protected]> * Remove unnecessary `(char *)` casts in LFS/flash telecommands (#211) Got rid of all unesseccary casts (char*)args_src in tthe flash and lfs telecomand definitions Co-authored-by: fardin.mahid <[email protected]> * Flash: Added status register telecommand (#212) * Added status register telecommand Added a flash telecommand that reads the status register value of the NAND flash module. * Update flash_telecommand_defs.c Added telecommand docstring for `TCMD_flash_read_status_register()`. * (TESTING) added write enable telecommand Created write enable telecommand for testing purposes to ensure the status register is read properly. * Update flash_telecommand_defs.c Mistake in writing docstring * Update flash_telecommand_defs.c Added const keyword to applicable variables, updated variables and log results for clarity of page numbering. * Update flash_telecommand_defs.c Updated docstrings for clarity of functions and their parameters * IOC: Enable ST Cryptolib, related fixes (#217) * Convert number_comparisons to not use math.h * IOC: Enable ST Cryptolib Steps: 1. Open CubeMX. 2. Go to Software Packs > Select Software Packs. 3. Enable `STMicroelectronics.X-CUBE-SAFEA1` 4. Enable `ST_Cryptolib`. 5. Click Ok. 6. Go to "Middleware and Software Packs". 7. Enable checkbox in `X-CUBE-SAFEA1`. * Add Cryptolib parts to CI Makefile #### Post-IOC Code Generation Steps: * Revert linker script change * Remove `x509.c` and `x509_crypto.c` bad files * Docs: Add IOC file regeneration guidelines * Move the `cts1_ground_support` folder to its own repo (#218) * Move the `cts1_ground_support` folder to its own repo * Update docs * Bring back CI tasks * FreeRTOS Thread to monitor high stack watermarks (#192) * Created osThread to monitor high stack watermarks * WIP * WIP * WIP: Addressing Hard Fault Issue * Created osThread to monitor high stack watermarks * WIP * WIP: Addressing Build Issues * Addressed PR changes * WIP:Addressing PR comments * Rebasing * Fixing rebase * Addressed PR * Rename `TASK_monitor_freertos_highstack_watermarks` to `TASK_monitor_freertos_memory` * Simplify threshold check logic; clarify variable names * Rename variable with namespace now, docs --------- Co-authored-by: DeflateAwning <[email protected]> * EPS: Only show first 17 EPS channels in JSON renders (#208) * Automated Python Unit Testing Framework (#206) * initial python test framework implementation * Added json extension for pytest debug Added function to read terminal lines and parse it to strings. Hello world tcmd unit test added * python unit test for echo arg and delay ms * Added environment variables for serial call * Renaming .env variables * Revert "IOC: Enable ST Cryptolib" (#220) * Revert "IOC: Enable ST Cryptolib, related fixes (#217)" This reverts commit 603f8e0. * Update docs for IOC generation Per discussion in #38, reverting this change. * Create MPI transceiver testing commands for OBC bring-up (#222) * Create mpi_demo_tx_to_mpi * Add repeat send for testing * Add transceiver code to MPI_send_telecommand_get_response --------- Co-authored-by: Aaryan Deshpande <[email protected]> * Antenna deploy: report durations in ms (#213) Antenna deploy: report durations in ms (issue # 213) Changed Report durations from intervals of 50 ms to intervals of 1 ms. Co-authored-by: fardin.mahid <[email protected]> * Implement SHA256 hash function (#223) * sha256 function implemented * benchmarked unit tests included * script for generating unit tests included Co-authored-by: DeflateAwning <[email protected]> * On-OBC temperature sensor driver (#178) OBC temp sensor driver which reports the temperature with configurable precision via telecommand. All unit tests included. Output screen shots included in pr. * Implement function and telecommand for syncing eps time to obc time (#207) * Implement functions and telecommands for syncing obc time to eps time and eps time to obc time * Add thread for setting obc time on bootup * Thread also monitors the difference between eps and obc time --------- Co-authored-by: DeflateAwning <[email protected]> * Added a section in docs for issues revolving Driver installation and … (#235) * Added a section in docs for issues revolving Driver installation and VS code setup. Added instrucations to follow along as well as my name in README * Update setup guide to clarify scope/applicability --------- Co-authored-by: DeflateAwning <[email protected]> * Implement `TCMDEXEC_comms_dipole_switch_set_state` (#229) * Fix link to cts1_ground_support to go to new repo (#237) * Added functionality to make warnings appear when LOG_message doesn't have same format as printf (#238) * Added functionality to make warnings appear when LOG_message doesn't have same format as printf Also fixed the warning that came up when functionality was added. * Explain `__attribute__` following `LOG_message` * Update `LOG_message` byte width --------- Co-authored-by: DeflateAwning <[email protected]> --------- Co-authored-by: DeflateAwning <[email protected]> Co-authored-by: Makiv1 <[email protected]> Co-authored-by: DeemDeem52 <[email protected]> Co-authored-by: Parker L <[email protected]> Co-authored-by: Muhammad Ali <[email protected]> Co-authored-by: Kale Fordham <[email protected]> Co-authored-by: Saksham Puri <[email protected]> Co-authored-by: Fardin Mahid <[email protected]> Co-authored-by: fardin.mahid <[email protected]> Co-authored-by: Christopher Kinyua <[email protected]> Co-authored-by: kev9268 <[email protected]> Co-authored-by: Aaryan Deshpande <[email protected]> Co-authored-by: Parker Graham <[email protected]> Co-authored-by: 2BlackCats <[email protected]>
Fixes #12