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

Hw timer #259

Closed
wants to merge 21 commits into from
Closed

Hw timer #259

wants to merge 21 commits into from

Conversation

Akashem06
Copy link
Member

No description provided.

vagrant and others added 3 commits January 30, 2024 17:54
* call autogen once per project

* use jinja for test_runner generation

* use pathlib for pathing

* clean up build.scons

* use emitter to define test.scons targets

* change smoke to its own project type, update scons docs

* use single option for target, fix test output format

* clean up lint format

* fix new target

* update python modules for build

* remove py can msg definition

* remove py-can-msg-gen from build.scons

* print out failed tests

* merge with main, resolve issues

* update build system doc

* unchange can id

* fix sim

* msg for when flash fails
TIM_Cmd(TIM2, ENABLE);
}

void hw_timer_delay_us(uint32_t us) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

So, a possible issue with this is if a task delays for say 2ms, then gets pre empted by a task that delays for 1ms, the higher priority task would reset the timer, complete its delay, and then when the original task takes over, the timer would be disabled. I'm not 100% sure what the best fix for this is but I'll have to think about that

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it? TIM_GetCounter should be an atomic call. So the unless it happens before start_count, it wouldn't be an issue right?
If that's the case, we could critical section this part until later

gpio_toggle_state(&leds[0]);
gpio_toggle_state(&leds[3]);
LOG_DEBUG("HW Delay");
hw_timer_delay_ms(100);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Kind of a nitpick, I'd say test a shorter delay like 300us. It better reflects the use case of a module like this. I think you said you'd previously tested that though

Copy link
Member Author

Choose a reason for hiding this comment

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

I tested with 10us and it worked, but I can change the smoke tests delay

Akashem06 and others added 5 commits February 3, 2024 15:38
* modified autogen and created can parsing DBC file + jinja files

* removed redundant variables and added vcan0 in autogeneration (CAN BE CHANGED TO CAN0)

* added .zfill(3) to fill up hex message

* Modified all main.c files to rely on autogenerated can IDS. Added constant messaging function with multiprocessing

* formatted all files

* removed redundant variable

* Updated device ID's for can communication and can debuging with autogen values

* formatting

* opted to use threading over multiprocessing library

---------

Co-authored-by: vagrant <vagrant@midsunbox>
* Added PD modifications for rev 2

* formatting

* delete patch file

* removed redundant logic

* Added task stack param and updated brake light function to prv_ function

* Updated FSM functions with new params

* updated test_fsm

* updated test_fsm

* random file deleted

---------

Co-authored-by: vagrant <vagrant@midsunbox>
Copy link
Collaborator

@Bafran Bafran left a comment

Choose a reason for hiding this comment

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

almost lgtm

start_count = current_count;
}

TIM_Cmd(TIM2, DISABLE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a function for init and enable the timer

@Bafran
Copy link
Collaborator

Bafran commented Mar 11, 2024

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.

5 participants