Skip to content
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

gps: use GPIO interrupt to track pulse per second (PPS) into a counter variable #239

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

2BlackCats
Copy link
Contributor

It should check to see if PIN A6(GPS_PPS_PIN) changes using a external interrupt to increase a counter. Please double check my logic. Thx

Copy link
Contributor

@NuclearTea NuclearTea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Needs to be rebased before it can be reviewed

2BlackCats and others added 6 commits December 1, 2024 18:43
I wasn't sure where to put the files so I created a new folder for gps and telecommand GPS.
Will not enable if GPS is not powered on, and if it is turned off and interrupt is called to turn off interrupt.
* Implement `TCMDEXEC_comms_dipole_switch_set_state` (#229)

* Fix link to cts1_ground_support to go to new repo (#237)

* IOC TESTING - Convert PIN_GPS_PPS_IN to EXTI mode

---------

Co-authored-by: DeflateAwning <[email protected]>
Co-authored-by: Muhammad Ali <[email protected]>
…t through interrupt

Added additional functions to ensure variable are private and can't be changed through other functions.
@2BlackCats 2BlackCats force-pushed the Alex_On/122-gps-track-the-pps-pulse-per-second-pulses-into-a-counter-variable-since-the-last-sync branch from 4459aa6 to 7f699ea Compare December 2, 2024 01:46
@2BlackCats 2BlackCats requested a review from NuclearTea December 2, 2024 01:51
@DeflateAwning
Copy link
Contributor

Please name your pull request in a way that clearly and exclusively describes the change(s). Do not include "Alex on/122..." from the branch name

@2BlackCats 2BlackCats changed the title Alex on/122 gps track the pps pulse per second pulses into a counter variable since the last sync gps: Setting up external interrupt to track the pps pulse per second pulses into a counter variable Dec 3, 2024
@DeflateAwning DeflateAwning changed the title gps: Setting up external interrupt to track the pps pulse per second pulses into a counter variable gps: use GPIO interrupt to track pulse per second (PPS) into a counter variable Dec 4, 2024
Copy link
Contributor

@DeflateAwning DeflateAwning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Just a few fixes though.

.vscode/settings.json Outdated Show resolved Hide resolved
firmware/Core/Inc/gps/gps_pps_interrupt.h Outdated Show resolved Hide resolved
firmware/Core/Inc/gps/gps_pps_interrupt.h Outdated Show resolved Hide resolved
response_output_buf, response_output_buf_len,
"PPS tracking enabled");
return 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix indentation. Use 4 spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should already be 4 spaces if I'm not wrong. for all of those lines.

firmware/Core/Src/telecommands/telecommand_definitions.c Outdated Show resolved Hide resolved
2BlackCats and others added 5 commits December 3, 2024 20:07
Moved EXTI handler location
* Enabled EXTI lines [9:5] using CubeMX

* Changes to make EXTI work

---------

Co-authored-by: NuclearTea <[email protected]>
0000000000000+0000468360_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 121

FrontierSat time: 19700101T00:07:48.933, Uptime: 468934 ms
FrontierSat time: 19700101T00:07:49.928, Uptime: 469929 ms
0000000000000+0000470653_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 122

FrontierSat time: 19700101T00:07:50.923, Uptime: 470924 ms
0000000000000+0000471796_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 123

OBC->EPS DATA (no tags): 1A 07 06 00
OBC->EPS DATA (with tags): 3C 63 6D 64 3E 1A 07 06 00 3C 2F 63 6D 64 3E
EPS->OBC ERROR: timeout before first byte received
0000000000000+0000471897_N [EPS:ERROR]: EPS_CMD_watchdog() -> Error: 3
FrontierSat time: 19700101T00:07:51.918, Uptime: 471919 ms
0000000000000+0000472697_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 124

FrontierSat time: 19700101T00:07:52.914, Uptime: 472915 ms
0000000000000+0000473041_N [EPS:NORMAL]: Setting OBC time based on EPS time because last_source == TIM_SOURCE_NONE
OBC->EPS DATA (no tags): 1A 07 40 00
OBC->EPS DATA (with tags): 3C 63 6D 64 3E 1A 07 40 00 3C 2F 63 6D 64 3E
EPS->OBC ERROR: timeout before first byte received
0000000000000+0000473120_N [EPS:ERROR]: EPS_set_obc_time_based_on_eps_time() -> Error
0000000000000+0000473567_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 125

FrontierSat time: 19700101T00:07:53.909, Uptime: 473910 ms
0000000000000+0000474424_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 126

FrontierSat time: 19700101T00:07:54.904, Uptime: 474905 ms
0000000000000+0000475244_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 127

FrontierSat time: 19700101T00:07:55.899, Uptime: 475900 ms
0000000000000+0000476728_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 128

FrontierSat time: 19700101T00:07:56.894, Uptime: 476895 ms
0000000000000+0000477571_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 129

FrontierSat time: 19700101T00:07:57.889, Uptime: 477890 ms
0000000000000+0000478127_N [EPS:NORMAL]: Setting OBC time based on EPS time because last_source == TIM_SOURCE_NONE
OBC->EPS DATA (no tags): 1A 07 40 00
OBC->EPS DATA (with tags): 3C 63 6D 64 3E 1A 07 40 00 3C 2F 63 6D 64 3E
EPS->OBC ERROR: timeout before first byte received
0000000000000+0000478206_N [EPS:ERROR]: EPS_set_obc_time_based_on_eps_time() -> Error
FrontierSat time: 19700101T00:07:58.884, Uptime: 478885 ms
0000000000000+0000479015_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 130

FrontierSat time: 19700101T00:07:59.879, Uptime: 479880 ms
FrontierSat time: 19700101T00:08:00.874, Uptime: 480875 ms
0000000000000+0000481356_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 132

FrontierSat time: 19700101T00:08:01.869, Uptime: 481870 ms
0000000000000+0000482166_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 133

FrontierSat time: 19700101T00:08:02.864, Uptime: 482865 ms
0000000000000+0000483015_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 134

0000000000000+0000483213_N [EPS:NORMAL]: Setting OBC time based on EPS time because last_source == TIM_SOURCE_NONE
OBC->EPS DATA (no tags): 1A 07 40 00
OBC->EPS DATA (with tags): 3C 63 6D 64 3E 1A 07 40 00 3C 2F 63 6D 64 3E
EPS->OBC ERROR: timeout before first byte received
0000000000000+0000483292_N [EPS:ERROR]: EPS_set_obc_time_based_on_eps_time() -> Error
FrontierSat time: 19700101T00:08:03.859, Uptime: 483860 ms
0000000000000+0000484345_N [TELECOMMAND:NORMAL]: GPS PPS interrupt. Counter: 135

Works as long as it is pulsed.
@2BlackCats 2BlackCats added pr-please-review Indicator for someone to review a PR and removed pr-awaiting-testing labels Dec 13, 2024
@2BlackCats
Copy link
Contributor Author

Current Code works to count up when quickly pressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-please-review Indicator for someone to review a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GPS: Track the PPS (pulse-per-second) pulses into a counter variable, since the last sync
3 participants