Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists