Skip to content

Conversation

@wakandanwilson
Copy link
Contributor

@wakandanwilson wakandanwilson commented Jan 28, 2025

Change Description

Implemented hardware WDT to work with FreeRTOS.

Why the change is needed and implementation details

Needed as a safety feature to ensure that all sensors are working, if not then we reset the teensy.

Testing and validation

Tested by commenting out the Watchdog_Pet() line and added several print statements to track system flow. If Watchdog_Pet() is not called, the trigger statement will print to warn that system reset is happening and then once the timeout window closes, a statement will print and the system will reset automatically.

@github-actions
Copy link

github-actions bot commented Jan 28, 2025

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v14.0.6) reports: 2 file(s) not formatted
  • fsae-vehicle-fw/src/main.cpp
  • fsae-vehicle-fw/src/peripherals/watchdog.cpp

Have any feedback or feature suggestions? Share it here.

Copy link
Contributor

@billofright billofright left a comment

Choose a reason for hiding this comment

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

Really good start! A few structural things here and there but it's really good code. Try testing this on an actual teensy when you get the chance. Also, reminder to change the name of the PR to a relevant description!

billofright and others added 8 commits February 20, 2025 09:58
…re no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]

  152 |   config.trigger = constrain(config.trigger, 0.0f, 127.5); /* callback trigger before timeout */
      |                    ^~~~~~~~~
.pio\libdeps\teensy41\WDT_T4/Watchdog_t4.tpp:152:20: warning: there are no arguments to 'constrain' that depend on a template parameter, so a declaration of 'constrain' must be available [-fpermissive]
  152 |   config.trigger = constrain(config.trigger, 0.0f, 127.5); /* callback trigger before timeout */
      |                    ^~~~~~~~~# On branch wn/watchdog
@@ -0,0 +1,16 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

im not sure why its there, it mightve been bc i saved it as a workspace. this file can be deleted.


void threadMain(void *pvParameters) {
Serial.begin(9600);
vTaskDelay(pdMS_TO_TICKS(100));
Copy link
Contributor

Choose a reason for hiding this comment

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

each tick is by default 1ms so u dont have to do pdms_to_ticks

}

void myCallBack(){
Serial.println("WARNING: WATCHDOG NEEDS TO BE PET.");
Copy link
Contributor

Choose a reason for hiding this comment

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

does it reboot the teensy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, if Watchdog_pet() isnt called, the trigger point will be reached and then the system will reset automatically once the timeout window ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants