FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! 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.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [April 2011 Threads] ConfigIntUART2 call seems to kill other tasksPosted 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 tasksPosted 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 tasksPosted 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 tasksPosted 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 tasksPosted 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 tasksPosted 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 tasksPosted 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 tasksPosted 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 tasksPosted 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!
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|