Hello, I am using FreeRTOS for my project. The primary tasks for the Scheduler have LED blinking code. I am trying to configure an Interrupt for INT1 signal. But when ever the interrupt occurs the chip enters _general__general_exception_handler(). Following are my Hardware & Software Details: PIC32MX360F512L SYSCLK = 40MHz PBCLK = 40MHz MPLAB 8.15a MPLAB C32 v1.04 FreeRTOS v5.1.0 MyCode: http://sites.google.com/site/pic32site/Home/24_FreeRTOStest5code.zip Kindly help me out with this. Warm Regards, Boseji My PIC32 Project: http://www.mypic32.com/web/guest/contestantsprofiles?profileID=32956
The way the interrupt is written looks just like the serial port example from the demo, except the line void __ISR(_INT1_VECTOR,ipl2) vINT1Handler(); in your code, and the equivalent void __attribute__( (interrupt(ipl1), vector(_UART2_VECTOR))) vU2InterruptWrapper( void ); for the serial port example. Is the __ISR equivalent to the __attribute__?
Hello, I have tested the code with the following code: void __attribute__( (interrupt(ipl2), vector(_INT1_VECTOR))) vINT1Handler(); This is the same as that of the __ISR when I referred to the C32 documentation. I am suspicious of the code in prvSetupHardware(): /* Setup to use the external interrupt controller. */ INTEnableSystemMultiVectoredInt(); portDISABLE_INTERRUPTS(); //I am not very sure what this is about This function is called in the beginning of the Main function and never called again. But the _general_exception still occurs. Kindly help me out understanding this. Thanks, Warm Regards, Boseji My PIC32 Project: http://www.mypic32.com/web/guest/contestantsprofiles?profileID=32956
INTEnableSystemMultiVectoredInt() sets the microcontroller to use multi vectored mode rather than routing all interrupts through a single vector entry. The PIC32 has to option to use both methods. portDISABLE_INTERRUPTS() is called to prevent interrupts from occurring before the scheduler has been started. This is because any interrupt that executes and attempts a context switch (or maybe even calls an API function) before the scheduler has started could cause the system to crash. Interrupts are automatically re-enabled as the context of the first task to run is restored. Regards.
Hello, I have tried lots of tricks but the program still enters the "_general_exception_handler". Although going through the FreeRTOS demo I realized the fact that there is some separate context switch required for the Interrupt but even that did not help. Another thing that I observed when I was in the "_general_exception_handler" the Interrupt Flag for the INT1 interrupt shows in the INTSTAT register along with the priority of the vector. This means that some where the OS is crashing and and giving rise to some un-handled exception. If there is simpler example for the interrupt handling under FreeRTOS port for PIC32 please let me know. Kindly help me out with this. Warm Regards, Boseji My PIC32 Project: http://www.mypic32.com/web/guest/contestantsprofiles?profileID=32956
Hello, After a lot of tries I was able to get some help from the Microchip forum. There was a mistake in the Interrupt vector name: void __ISR(_INT1_VECTOR,ipl2) vINT1Handler(); //Wrong Corrected Line: void __ISR(_EXTERNAL_1_VECTOR,ipl2) vINT1Handler(); //Alright However the compiler didn’t complain so I was unable to gauge that. Thanks for your Support. Warm Regards, Boseji My PIC32 Project: http://www.mypic32.com/web/guest/contestantsprofiles?profileID=32956
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.