DsPIC33 UART Oscillates

I find that when more than one task is running on a dsPIC33256GP710 the serial ports do not work and start oscillating. The oscillation has a period of about 200us. The last 50us of the form is a negatively going triangular wave. This is with version 5.0.2 If I use version 4.5 then I find I can have two tasks but only one can write to a serial port. If two try then I get the oscillation. The harness is below: #define mainCHECK_TASK_STACK_SIZE            ( configMINIMAL_STACK_SIZE * 2 ) static void TestTask1( void *pvParameters ) {     while(1)     {         //SendChar1(’A’); // non-irq char send on UART1         taskYIELD();     }; }; static void TestTask2( void *pvParameters ) {     while(1)     {         //SendChar1(’B’);         taskYIELD();     }; }; int main() {     //     // Get the processor going at 40MIPs     //     PSVPAG = 0;     CORCONbits.PSV=1;     // we have a 10MHz crystal – we want 40MIPS     PLLFBD=32;                    // M=40     CLKDIVbits.PLLPOST=0;        // N1=2     CLKDIVbits.PLLPRE=0;        // N2=2     OSCTUN=0;                    // Tune FRC oscillator, if FRC is used     // Disable Watch Dog Timer     RCONbits.SWDTEN=0;     // Wait for PLL to lock     while(OSCCONbits.LOCK!=1) {};     //     _U1TXIE = 0;     _U1RXIE = 0;     _U1RXIF = 0;     U1MODE = 0; // 8 bits no parity 16 clocks per bit     U1STA = 0; // enable transmit – non – irq driven     //     U1MODE = 0x8000; // 8 bits no parity 16 clocks per bit     U1STA = 0x400; // enable transmit – non – irq driven     // set the baud rate to 57600     U1BRG = 45;     //     //     _U2TXIE = 0;     _U2RXIE = 0;     _U2RXIF = 0;     U2MODE = 0; // 8 bits no parity 16 clocks per bit     U2STA = 0; // enable transmit – non – irq driven     //     U2MODE = 0x8000; // 8 bits no parity 16 clocks per bit     U2STA = 0x400; // enable transmit – non – irq driven     // set the baud rate to 57600     U2BRG = 45;     // Create a task     //     xTaskCreate( TestTask1, "t1", mainCHECK_TASK_STACK_SIZE, NULL, 2, NULL );     xTaskCreate( TestTask2, "t2", mainCHECK_TASK_STACK_SIZE, NULL, 3, NULL );     //     /* Finally start the scheduler. */     vTaskStartScheduler();     return 0; }; // // // // // The idle hook void vApplicationIdleHook( void ) {     /* Schedule the co-routines from within the idle task hook. */     vCoRoutineSchedule();     // put the processor to sleep }

DsPIC33 UART Oscillates

I dont know what you mean by oscillates, but are you trying to access the UART from two different tasks simultaneously without any form of mutual exclusion or serialisation? If so that might be what your problem is.