Main Site Documentation

RLP and interrupts


#1

I open a SerialPort (COM3) in managed code.

Then I start RLP code that writes a byte to U2THR, this works fine, and transmits the byte over COM3.


void HCD_SendByte(BYTE Data)
{
	/* Wait until previous byte transmitted */
	while (!(U2LSR & LSR_THRE));
	U2THR = Data;
}

Now I’ve also installed an interrupt to detect when the THR is empty. (For now the code doesn’t filter the THRE interrupt)

Handler code:


void InterruptHandler(void * arg)
{
	RLPext->GPIO.WritePin(27, TRUE);
	RLPext->Delay(1000);
	RLPext->GPIO.WritePin(27, FALSE);
	VICVectAddr = 0;	/* Acknowledge Interrupt */
}

Installed with:


if (!RLPext->Interrupt.Install(UART2_INT, InterruptHandler, NULL))
 return FALSE;

The Interrupt.Install method doesn’t return false, so the interrupt should be installed fine. However, the interrupt handler never gets called.

Any ideas? (Maybe the managed code already installed an interrupt)


#2

Oops, fixed :slight_smile:

I had to set the interrupt enable bit + clear the interrupt bit in the interrupt handler.


#3

Remove “VICVectAddr = 0;” I believe it is already handled on our side.


#4

This is an old and outdated project but still a good reference


#5

My 485 protocol is already running :slight_smile:


#6

:clap:

Do you want to be the first to contribute RLP driver? :wink:


#7

Well I can’t share this protocol due to copyright stuff. But if anyone would be interested, I could bake an example.