Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

DsPIC33 UART Oscillates

Posted by Baz Hill on August 27, 2008
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
}

RE: DsPIC33 UART Oscillates

Posted by Dave on August 28, 2008
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.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner