RLP and interrupts

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->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)

Oops, fixed :slight_smile:

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

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

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

My 485 protocol is already running :slight_smile:


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

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