FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.

PWM on dsPIC33

I'm trying to use FreeRTOS port on dsPIC33FJ128GP206 and I need to drive a lot of servos. Servos are being driven with OC1-3 channels through multiplexers, OCx are using timer2. FreeRTOS is using timer1, as in example and is running at lowest priority timer interrupt (priority 1), while timer2 is running at priority 7. When tasks are switching it causes a lag or something and servos shake during context switch. Just to do some research on issue, I've replaced timer1 handler with some dummy code, to see if it will occur with same interrup priorities - everything is ok. As soon as I add RTOS functionality - jitter is back.How can I get rid of this? I think I've already tried everything, but the jitter is still present. The more tasks I add, the more jitter there is - shake per task (switch)

RE: PWM on dsPIC33

Are your drives being processed from an interrupt? If so, then setting the interrupt priority above configKERNEL_INTERRUPT_PRIORITY will ensure the interrupts do not get delayed by anything the kernel is doing. It does however also mean that the interrupts cannot call FreeRTOS API function (the functions that end in FromISR are safe on a PIC24/33 only if called from interrupts that run with a priority equal to configKERNEL_INTERRUPT_PRIORITY).

RE: PWM on dsPIC33

Does that mean your drives are being processed by the interrupts? I'm not sure. Are your tasks enabling and disabling interrupts using any method other than calling taskENTER_CRITICAL and taskEXIT_CRITICAL?

RE: PWM on dsPIC33

No, it's a very simple "Hello World" project. My only task is a simple led blinky. Just :for(;;) {_RD4++; vTaskDelay(1000 / portTICK_RATE_MS);}two lines, nothing more. Interrupt handler is also kept as simple as possible. Clear the flag and load value from an array. Array is static. No calls to anything from ISR, no complex calculations, no nothing:{IEC0bits.OC1IE = 0;IFS0bits.OC1IF = 0;if(++mux == 2) mux = 0;OC1RS = pwm[mux]; IEC0bits.OC1IE = 1;}Is this clear enough to see, how complex is the program I am running? Everything else is a code from freertos example. pmw[] is declared as pwm[2] = {1500,1500} and that's the only place it is being modified.