-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[BUG] Port MPLAB PIC32MZ-EF, Timer1 is 16bits #1265
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
Comments
Thank you for raising this. If I understand correctly, you want to add the following assert: /* PR1 is 16-bit. Ensure that the configPERIPHERAL_CLOCK_HZ and
* configTICK_RATE_HZ are defined such that ulCompareMatch value would fit
* in 16-bits. */
configASSERT( ( ulCompareMatch & 0xFFFF0000 ) == 0 ); If yes, we can add that. Would you like to raise a PR for that? |
I have some concerns. I'm new to the FreeRTOS "business" environment and how this port targets should work. However, there is info about using different timers for tick, but no warnings (or assert) about choose the right values for Timer1. I tested the configASSERT, the problem is that, again, on this port implementation, the timer configuration is performed before the scheduler start (makes sense), but the port implementation (generated/suggested by Microchip) of the configASSERT is:
at the moment the assert happens, the taskENTER_CRITICAL asserts because scheduler is not working. What do you suggest? Keep the configASSERT on timer? Change the vAssertCalled ? Is possible to check if scheduler is already running? |
The timer configuration happens in the function vApplicationSetupTickTimerInterrupt which is called when starting the scheduler.
On this port, the |
I did some more investigation, please check the code below for
Then
because:
|
Thank you for explaining. I understand that now.
If the above definition of |
portDISABLE_INTERRUPTS/portENABLE_INTERRUPTS should work but depends on the implementation (eg: may dump to a USART controlled by some ISR buffer). So it is implementation specific (and I think it is ok). Since vAssertCalled is on user (Microchip) side, I think should be ok on FreeRTOS project side to add what is reasonable. Even with the current vAssertCalled, it will crash me on a stack overflow, which if I backtrack with debug, I will find the |
You are right. I missed that the assert will only fire when configPERIPHERAL_CLOCK_HZ and/or configTICK_RATE_HZ is mis-configured. In other words, the default generated applications would continue to work. Would you like to raise a PR? |
Describe the bug
On the Port MPLAB PIC32MZ-EF, the Timer1 is 16bit
Target
To Reproduce
Expected behavior
The text was updated successfully, but these errors were encountered: