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

ConfigIntUART2 call seems to kill other tasks

Posted by Robert H. Oujesky on April 6, 2011
I have a custom board (PIC32) that should be quite similar to the Explorer 16 in terms of the UART. have a simple task that turns an LED on and off every second. Just a visual hearbeat :) I am trying to configure UART. When I call ConfigIntUART2 as follows:

ConfigIntUART2( ( configKERNEL_INTERRUPT_PRIORITY + 1 ) | UART_INT_SUB_PR0 | UART_TX_INT_EN | UART_RX_INT_EN );

the blinking light task stops running. But when I call it with the UART_INT_SUB_PR0 removed, all tasks seem to run fine.

I cannot understand what is going on. Can someone make a guess? I know it is vague.....

RE: ConfigIntUART2 call seems to kill other tasks

Posted by Richard on April 6, 2011
The code you have posted looks the same as for the demo provided.

Can you use the debugger to see what the processor is doing?

Do you have handlers defined for those interrupts?

Are the interrupt handlers trying to access kernel API functions before the scheduler has been started?

Just some suggestions to look at.

Regards.

RE: ConfigIntUART2 call seems to kill other tasks

Posted by Robert H. Oujesky on April 6, 2011
It is the demo provided, without some of the tasks created. Here is the streamed down version of main():

int main( void )
{
/* Configure any hardware required for this demo. */
prvSetupHardware();

/* All Tasks start here */

/* Start the task that will control the LCD. This returns the handle
to the queue used to write text out to the task. */
xLCDQueue = xStartLCDTask();

vStartLEDFlashTasks( mainCHECK_TASK_PRIORITY );
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
//vStartLEDFlashTasks( tskIDLE_PRIORITY );



/* Finally start the scheduler. */
vTaskStartScheduler();
//printf("starting\n");

/* Will only reach here if there is insufficient heap available to start
the scheduler. */
for(;;);
return 0;
}

I can step around in the debugger, I set a breakpoint in the flash task and it never seems to get there.

thanks!

RE: ConfigIntUART2 call seems to kill other tasks

Posted by Robert H. Oujesky on April 6, 2011
One more thing. Here is the code from the xSerialPortInitMinimal function. It turns out I must have lied earlier... leaving out the UART_INT_SUB_PR0 or'ing now does not seem to matter. the flasher task does not run. If I comment out the call to ConfigIntUART2 then, the flasher task runs. Obviously, I am screwing up interrupts somehow.....

xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
unsigned portSHORT usBRG;

/* Create the queues used by the com test task. */
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );

/* Configure the UART and interrupts. */
//usBRG = (unsigned portSHORT)(( (float)configPERIPHERAL_CLOCK_HZ / ( (float)16 * (float)ulWantedBaud ) ) - (float)0.5);
usBRG = (unsigned portSHORT) 21; // corky temp for 115200 baud
OpenUART2( UART_EN, UART_RX_ENABLE | UART_TX_ENABLE | UART_INT_TX | UART_INT_RX_CHAR, usBRG );
ConfigIntUART2( ( configKERNEL_INTERRUPT_PRIORITY + 1 ) | UART_INT_SUB_PR0 | UART_TX_INT_EN | UART_RX_INT_EN );// &&&&&&&&&&&&&
//ConfigIntUART2( ( configKERNEL_INTERRUPT_PRIORITY + 1 ) | UART_TX_INT_EN | UART_RX_INT_EN );// &&&&&&&&&&&&&

xTxHasEnded = pdTRUE;

/* Only a single port is implemented so we don't need to return anything. */
return NULL;
}

RE: ConfigIntUART2 call seems to kill other tasks

Posted by Robert H. Oujesky on April 6, 2011
OK, it now works... Of course, it is a self inflicted wound :( Please dont make me go into the details....

RE: ConfigIntUART2 call seems to kill other tasks

Posted by Robert H. Oujesky on April 7, 2011
I *thought* it was a self inflicted wound, but now I have my doubts. the custom board uses the PIC32MX795F512L and the Explorer 16 uses PIC32MX360F512L. I would bounce back and forth between boards to try and make sense of my problem. It turns out that the custom board works if I leave it configured for the PIC32MX360F512L!!!!!! I suspect that the 795 is so new, there are bugs in MPLAB when configuring the chip. there is a new version of MPLAB and I will try it.

RE: ConfigIntUART2 call seems to kill other tasks

Posted by Richard on April 7, 2011
The 795 has an updated core compared to the 360 and requires an extra configuration parameter. I use the following on the 795 to configure the device from the source code (rather than through MPLAB).

#pragma config FPLLODIV = DIV_1, FPLLMUL = MUL_20, FPLLIDIV = DIV_2
#pragma config FWDTEN = OFF, FPBDIV = DIV_2, POSCMOD = XT, FNOSC = PRIPLL, CP = OFF
#pragma config FSRSSEL = PRIORITY_7


The last line is needed for 795 projects and should be omitted for 360 projects.

Regards.

RE: ConfigIntUART2 call seems to kill other tasks

Posted by Robert H. Oujesky on April 7, 2011
I upgraded to the latest MPLAB 8.66 and that did not help. It has dawned on me that maybe since the demo I am running was created for the PIC32MX360F512L, is there something I need to change in the source somewhere to work correctly for the PIC32MX360F512L?
Any help would be appreciated.

thanks!

RE: ConfigIntUART2 call seems to kill other tasks

Posted by Robert H. Oujesky on April 8, 2011
I think our two last posts crossed on the internet, so ignore my last post, you answered it.
I put those 3 pragma lines in my main and it made no improvement. I am still not sure how to get the system configured for the 795.... any other ideas?

thanks!


[ 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