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] [July 2013 Threads] Code crach when adding FreeRTOS to PIC32MX795Posted by Karen on July 22, 2013 Hope it is the right place asking FreeRTOS related question using PIC32MX795F512L.
I am new to PIC32.
I made four external interrups (INT1 to INT4) and CAN 1 working properly on the board (not start kit, I don't have start kit). Then I added FreeRTOS to the code. The issue is that after adding FreeRTOS, the code always crashes as soon as calling vTaskStartScheduler(). I noticed that if I only made the CAN 1 running, it works ok, as long as enabling external interrupts, even just one, the software crash. On the PIC32, I also set up PWM to output clocks and setup 4 SPI buses (setup to master), but there is no interrupts on SPI bus.
This is the external interrupt routine, all four external interrupts have almost the same code except line msg.data[0] = 0;
/* Meter 1 IRQ */ void __ISR(_EXTERNAL_1_VECTOR, ipl3) INT1Interrupt(void) { struct ipc_message msg; portBASE_TYPE err; if(mPORTEReadBits(BIT_8) == 0) { /* Disable further interrupt from INT1 since need to process interrupt */ disable_mcu_INT(1); msg.command = IPC_INTERRUPT_REQUEST; msg.data[0] = 0; /* task uses zero-based */ err = xQueueSendToBackFromISR(meters_ipc.ipc_inbox, &msg, NULL); if(err == errQUEUE_FULL) { meters_ipc.ipc_overflow = 1; } else { if(meters_ipc.ipc_overflow == 1) meters_ipc.ipc_overflow = 0; } } }
on FreeRTOSConfig.h, defined:
/* The priority at which the tick interrupt runs. This should probably be kept at 1. */ #define configKERNEL_INTERRUPT_PRIORITY 0x01
/* The maximum interrupt priority from which FreeRTOS.org API functions can be called. Only API functions that end in ...FromISR() can be used within interrupts. */ #define configMAX_SYSCALL_INTERRUPT_PRIORITY 0x03
I also setup
/* SYSCLK = 80 MHz (8MHz Crystal/ FPLLIDIV * FPLLMUL / FPLLODIV) */ #pragma config FPLLMUL = MUL_20 /* In DEVCFG2 */ #pragma config FPLLIDIV = DIV_2 /* In DEVCFG2 */ #pragma config FPLLODIV = DIV_1 /* In DEVCFG2 */ #pragma config FWDTEN = OFF #pragma config POSCMOD = HS /* In DEVCFG1 */ #pragma config FNOSC = PRIPLL /* In DEVCFG1 */ #pragma config FPBDIV = DIV_1 /* In DEVCFG1 */ /* code protect, boot write protect, flash write protect */ #pragma config CP = OFF, BWP = OFF, PWP = OFF #pragma config UPLLEN = OFF #pragma config FSRSSEL = PRIORITY_7
At the beginning of the main() loop, I called:
SYSTEMConfig(SYS_CLOCK, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);
any problem on it?
Very appreciate for the help.
Karen
RE: Code crach when adding FreeRTOS to PIC32MX795Posted by MEdwards on July 22, 2013 You need some simple wrappers on your ISR. Look at the Interrupt Service Routines section on this page for an example http://www.freertos.org/port_PIC32_MIPS_MK4.html
Then with the settings you show in your post make sure the interrupt priority is 3 or below.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|