My configuration:
PIC32MX675F512H
MPLAB X
FreeRTOS 7.1.1 I have to make a wrapper for the interrupt so i make a file named “Interrupts_isr.S” containing this:
#include <p32xxxx.h>
#include <sys/asm.h>
#include "../FreeRTOS/ISR_Support.h"
/******************************************************************/
.extern vU3InterruptHandler
.global vU3InterruptWrapper
.set noreorder
.set noat
.ent vU3InterruptWrapper
vU3InterruptWrapper:
portSAVE_CONTEXT
jal vU3InterruptHandler
nop
portRESTORE_CONTEXT
.end vU3InterruptWrapper
then a file containing the handler “Interrupts.c” :
#include "Interrupts.h"
#include <stdio.h>
#include <plib.h>
extern void __attribute__( (interrupt(ipl1), vector(_UART_3_VECTOR))) vU3InterruptWrapper( void );
//this handler toggles a led when arriving into it so i can know if my interrupt works
void vU3InterruptHandler (void)
{
for( ;; )
{
long int i;
for(i=0; i<100000 ; i++);
mPORTEToggleBits(BIT_2);
}
}
and i’m déclaring the interrupt like this:
void init_UART_FIFO_TX()
{
U3STAbits.UTXISEL1 = 1; //interrupt when buffer is empty
U3STAbits.UTXISEL0 = 0; //
UARTEnable(UART3, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_TX));
INTSetVectorPriority(INT_VECTOR_UART(UART3), INT_PRIORITY_LEVEL_7);
INTSetVectorSubPriority(INT_VECTOR_UART(UART3), INT_SUB_PRIORITY_LEVEL_0);
INTEnable(INT_SOURCE_UART_TX(UART3), INT_DISABLED);
INTEnableInterrupts();
}
at the begining of my main i have put also
INTEnableSystemMultiVectoredInt();
THE PROBLEM:the interrupt is occurring OK but is not redirecting into MY handler but into the _general_exception_handler() that is by default.
It seems that my new wrapper hasn’t overwritten the _general_exception_handler for the UART3 vector! Thanks for all your help!!!!