Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
49c2fb6
solids project setup
zizz-0 Oct 19, 2025
4693d9f
solids test code builds, untested
zizz-0 Oct 23, 2025
94a8979
new overlay and adc channel cfg
zizz-0 Oct 23, 2025
e2b3276
folder renamed
zizz-0 Oct 23, 2025
a178bd6
broken :(
zizz-0 Oct 23, 2025
0904818
fixes n things
cowsed Oct 23, 2025
abea238
merge conflict :(
zizz-0 Oct 23, 2025
1c08ff9
Merge branch 'zizz/solids-test-board' of https://github.com/RIT-Launc…
zizz-0 Oct 23, 2025
f04f221
halfway working maybe
zizz-0 Oct 23, 2025
6b274fe
renamed fr this time
zizz-0 Oct 23, 2025
93401a2
flash dump works, adc reading not working fast enough :(
zizz-0 Oct 24, 2025
1ec5a0c
got left bc of merge
cowsed Oct 24, 2025
4ffc9bb
erase command, writing in blocks
cowsed Oct 24, 2025
56739fc
adc fine tuning/optimiaztion
cowsed Oct 24, 2025
226d095
instrumenting
cowsed Oct 24, 2025
170f331
DMAing it up
cowsed Oct 24, 2025
0a85a5d
ematches and reading misses
cowsed Oct 24, 2025
b9bb43f
stashing changes - button interrupt (not done)
zizz-0 Oct 24, 2025
9e82edd
Merge branch 'zizz/solids-test-board' of https://github.com/RIT-Launc…
zizz-0 Oct 24, 2025
8618a1f
solids test probably done. buzzer unfortunately on. tx/rx button work…
zizz-0 Oct 25, 2025
6736b06
checkl on flash test
cowsed Oct 25, 2025
a43ff19
set ematch/estop shell cmds, ematch set 500ms into adc reading instea…
zizz-0 Oct 25, 2025
feea5ce
Merge branch 'zizz/solids-test-board' of https://github.com/RIT-Launc…
zizz-0 Oct 25, 2025
554c8f0
formatting
zizz-0 Oct 25, 2025
d82bf52
shell print n
cowsed Oct 26, 2025
7d246a5
formatting, comments, button functions moved
zizz-0 Oct 28, 2025
2bbf7ef
sys init
zizz-0 Oct 28, 2025
9837e91
main commands print update
zizz-0 Oct 28, 2025
a48a8bc
function definitions and sys_init
zizz-0 Oct 30, 2025
5dcc0ee
even more formatting
zizz-0 Nov 4, 2025
3955b55
logging fixed
zizz-0 Nov 11, 2025
d2b1cf4
don't blow up solids members code (calibration name, key switch, very…
zizz-0 Dec 1, 2025
2c33dde
buzzer task tested
zizz-0 Dec 1, 2025
827931f
comments, formatting, updated continuous_beep
zizz-0 Dec 1, 2025
9ae27ca
print whether test is terminal or meep, terminal formatting
zizz-0 Dec 2, 2025
afdbe5d
comments, rx/tx gpio interrupt conf flags
zizz-0 Dec 2, 2025
c65f31d
set buzzer back to buzzer instead of led :(
zizz-0 Dec 9, 2025
be6d159
swap tx/rx and button/key_switch
zizz-0 Dec 19, 2025
f71d876
clarifying comments
zizz-0 Dec 19, 2025
038a463
sample name
zizz-0 Dec 19, 2025
2ea3dde
clarified comments, fixed values (spi max freq, added const calib nam…
zizz-0 Dec 29, 2025
ca4a05d
clarified more comments, fix print statements, protect against concur…
zizz-0 Dec 29, 2025
40e4dd6
void*, void*, void* on tasks to avoid warnings, tasks exposed in head…
zizz-0 Dec 29, 2025
17b0b7e
while(true) instead of while(1), removed button and key switch intern…
zizz-0 Jan 10, 2026
fe85e14
fwd declares
zizz-0 Jan 24, 2026
1613455
key switch active low
cowsed Feb 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/other/airbraker/quaternions
Submodule quaternions added at a5ef2e
8 changes: 8 additions & 0 deletions app/other/solids_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(grim_reefer LANGUAGES C)

FILE(GLOB sources src/*.c)
target_sources(app PRIVATE ${sources})
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
1 change: 1 addition & 0 deletions app/other/solids_test/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source "Kconfig.zephyr"
60 changes: 60 additions & 0 deletions app/other/solids_test/boards/grim_reefer.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/delete-node/ &adc;

/ {
zephyr,user {
io-channels = <&adc 0>;
};

aliases {
adc0 = &adc;
buzzer = &buzzer;
};

leds: leds {
button: button{ // TX
gpios = <&gpioa 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
label = "Button";
};
key_switch: key_switch{ // RX
gpios = <&gpioa 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
label = "Key Switch";
};
};
};

&uart4 {
status = "disabled";
};

&spi2 {
status = "okay";
adc: mcp3561@0 { // new and cool driver
#io-channel-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
compatible = "microchip,mcp356xr";
status = "okay";
reg = <0>;
address = <1>;
analog-clock-prescaler = <0>;
boost-current-bias = <0>;
spi-max-frequency = <DT_FREQ_M(20)>;
irq-gpios = <&gpiob 14 GPIO_ACTIVE_LOW>;
use-internal-clock;

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_32";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;

zephyr,resolution = <24>;

zephyr,differential;
zephyr,input-positive = <0x1>;
zephyr,input-negative = <0x0>;

zephyr,oversampling = <7>;
};
};
};
44 changes: 44 additions & 0 deletions app/other/solids_test/include/adc_reading.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef ADC_READING_H
#define ADC_READING_H

#include <stdint.h>
#include <stdbool.h>

/**
* @brief Struct to hold one ADC sample
*/
struct adc_sample {
uint32_t timestamp; /** Timestamp the sample was recorded in µs */
int32_t value; /** Value of the sample */
};

/**
* @brief Initialize the ADC device and channel
* @return 0 if successful
*/
int adc_init();

/**
* @brief Read one ADC sample
* @param[out] adc_val Pointer to value where sample will be written
*/
void adc_read_one(uint32_t *adc_val);

/**
* @brief Waits for ADC reading event to start, then reads ADC samples for 10 seconds
*/
void adc_reading_task(void*, void*, void*);

/**
* @brief Starts test
* @param[in] terminal_test Whether test was triggered by terminal cmd or meep
* If test was triggered by terminal, ematch will NOT light
*/
void adc_start_reading(bool terminal_test);

/**
* @brief Stops test
*/
void adc_stop_recording();

#endif // ADC_READING_H
19 changes: 19 additions & 0 deletions app/other/solids_test/include/button.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef BUTTON_H
#define BUTTON_H

#include <zephyr/drivers/gpio.h>
#include <zephyr/device.h>
#include <stdint.h>

/**
* @brief Configures TX and RX pins as gpio
* @return 0 if successful
*/
int button_switch_init();

/**
* @brief Thread to beep continuously if key switch is closed and test is not started
*/
void buzzer_task(void*, void*, void*);

#endif // BUTTON_H
48 changes: 48 additions & 0 deletions app/other/solids_test/include/buzzer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifndef BUZZER_H
#define BUZZER_H

/**
* @brief Configure buzzer and ldo gpio pins
* @return 0 if successful
*/
int buzzer_init();

/**
* @brief Start or stop buzzer
* @param[in] which Value to set buzzer
*/
void set_buzz(int which);

/**
* @brief Set ematch gpio pin
* @param[in] level Value to assign to pin
*/
void set_ematch(int level);

/**
* @brief Set ldo gpio pin
* @param[in] level Value to assign to pin
*/
void set_ldo(int level);

/**
* @brief Beep loudly in 1 second intervals for 10 seconds to indicate that flash is full (max tests reached)
*/
void beep_full();

/**
* @brief Beep loudly 3 times to indicate test start
*/
void test_start_beep();

/**
* @brief Beep loudly 2 times to indicate test end
*/
void test_end_beep();

/**
* @brief Beep until test starts
*/
void continuous_beep();

#endif // BUZZER_H
13 changes: 13 additions & 0 deletions app/other/solids_test/include/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef CONFIG_H
#define CONFIG_H

#define SAMPLE_RATE 1000
#define TEST_DURATION 10000 // ms
#define MAX_TESTS 30
#define CALIB_NAME_MAX_LEN 32 // If solids members need more than 32 characters then they need better naming standards

#define STORAGE_THREAD_PRIORITY 1
#define THREAD_START_DELAY 100
#define SYS_INIT_PRIORITY 1

#endif // CONFIG_H
63 changes: 63 additions & 0 deletions app/other/solids_test/include/control.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef CONTROL_H
#define CONTROL_H

#include <stdbool.h>
#include <zephyr/shell/shell.h>

/**
* @brief Starts flash storage and ADC reading
* @param[in] calib_name Name of calibration to store in flash storage
* @param[in] terminal_test Whether test was triggered by terminal cmd or meep
*/
void control_start_test(char calib_name[], bool terminal_test);

/**
* @brief Stops flash storage and ADC reading
*/
void control_stop_test();

/**
* @brief Reads and prints n number of ADC samples
* @param[in] shell Pointer to shell instance
* @param[in] num Number of samples to read
*/
void control_print_n(const struct shell *shell, int num);

/**
* @brief Dumps all ADC data from flash storage
* @param[in] shell Pointer to shell instance
*/
void control_dump_data(const struct shell *shell);

/**
* @brief Dumps one ADC test from flash storage
* @param[in] shell Pointer to shell instance
* @param[in] test_index The test number to dump
*/
void control_dump_one(const struct shell *shell, uint32_t test_index);

/**
* @brief Clear all flash blocks
* @param[in] shell Pointer to shell instance
*/
void control_erase_all(const struct shell *shell);

/**
* @brief Set ematch gpio high
* @param[in] shell Pointer to shell instance
*/
void control_set_ematch(const struct shell *shell);

/**
* @brief Set ematch gpio low
* @param[in] shell Pointer to shell instance
*/
void control_stop_ematch(const struct shell *shell);

/**
* @brief Get status of test
* @return Whether a test is running or not
*/
bool control_get_test_status();

#endif // CONTROL_H
49 changes: 49 additions & 0 deletions app/other/solids_test/include/flash_storage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#ifndef FLASH_STORAGE_H
#define FLASH_STORAGE_H

#include <zephyr/shell/shell.h>
#include <stdint.h>

/**
* @brief Thread to save test data to flash storage
*/
void flash_storage_thread_entry(void*, void*, void*);

/**
* @brief Begin flash storage event
* @param[in] calib_name Name of calibration to store. Defaults to "Test [#]" if empty or default string passed in
* @param[in] terminal_test Whether test was triggered by terminal cmd or meep
* @return 0 if successful
*/
int start_flash_storage(char calib_name[], bool terminal_test);

/**
* @brief End flash storage event
*/
void stop_flash_storage();

/**
* @brief Dumps one ADC test from flash storage
* @param[in] shell Pointer to shell instance
* @param[in] test_index The test number to dump
* @return 0 if successful
*/
int flash_dump_one(const struct shell *shell, uint32_t test_index);

/**
* @brief Dumps all ADC data from flash storage
* @param[in] shell Pointer to shell instance
* @return 0 if successful
*/
int flash_dump_all(const struct shell *shell);

/**
* @brief Clear all flash blocks
* @param[in] shell Pointer to shell instance
* @return 0 if successful
*/
int flash_erase_all(const struct shell *shell);

extern struct k_msgq storage_control_queue;

#endif // FLASH_STORAGE_H
47 changes: 47 additions & 0 deletions app/other/solids_test/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
CONFIG_SENSOR=y
CONFIG_SENSOR_SHELL=y
CONFIG_SPEED_OPTIMIZATIONS=y
CONFIG_SYS_CLOCK_TICKS_PER_SEC=100000

CONFIG_EVENTS=y
CONFIG_BASE64=y

# Logging
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=n
CONFIG_CRC=y

# GPIO and bus enables
CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_SPI=y
CONFIG_SPI_STM32_DMA=y

# ADC + sensor enables
CONFIG_ADC=y
CONFIG_ADC_LOG_LEVEL_ERR=y # Will spam annoying error at wrn level

CONFIG_ADC_MCP356XR=y
CONFIG_ADC_MCP356XR_THREAD_STACK_SIZE=2048
CONFIG_ADC_MCP356XR_THREAD_PRIORITY=21
CONFIG_INA260=y

CONFIG_SPI_NOR_SFDP_RUNTIME=y
CONFIG_SPI_NOR_SLEEP_ERASE_MS=10

# Flash + file system
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_DISK_ACCESS=y
CONFIG_FILE_SYSTEM=y

# Data dumping
CONFIG_SHELL=y
CONFIG_FLASH_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=y
CONFIG_UART_CONSOLE=y

CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CBPRINTF_FP_SUPPORT=y
9 changes: 9 additions & 0 deletions app/other/solids_test/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sample:
description:
name: solids_board
common:
build_only: true
platform_allow:
- grim_reefer
tests:
solids_test.default: {}
Loading
Loading