MOD54415 sending UDP packet from IRQ7 ISR routine
Posted: Wed Oct 07, 2015 7:10 pm
I'm trying to do the impossible, the forbidden. I'm trying to send a tiny UDP packet from an IRQ7 interrupt function. I've created a circuit that raises the IRQ7 pin high when the circuit board voltage drops below a certain level (Undervoltage Lockout or UVLO). What I've been able to do in the interrupt function (just experimentation) is actually get out 1-2 printf statements and call the assembly "HALT" prior to the filter capacitors on the board actually draining too low that the DC converters shut off. To test this I've just unplugged the power cord at the board. Works every time. What I'd like to do is send a UDP packet out instead of a printf statement. Considering that printf is notoriously slow, I figured a UDP packet would be much faster and I should have enough power to pull off sending just one packet with a 4 byte payload. That being said, I'm not extremely well versed in network protocols so I'm reaching out to the community.
Currently, I have declared a global UDP packet in my namespace, and a function is called from the namespace at bootup that sets up the UDP packet:
That being said, I know I run into a privelage violation by calling "IRQ7packet.Send(ipaddr);" from the IRQ function. I tried setting up a task with a priority of "MAIN_PRIORITY - 10" and posting a semaphore, but that doesn't work. Is there a way to manually create and send a packet from within the IRQ7 ISR? My other concern with using a an OS task is that I'll ahve to wait for the current task to complete before the pending semaphore is answered. Anyone got any better ideas? Thanks!
Currently, I have declared a global UDP packet in my namespace, and a function is called from the namespace at bootup that sets up the UDP packet:
Code: Select all
// GLOBAL - for reference:
UDPPacket IRQ7packet;
void IRQ7_packet_setup()
{
IRQ7packet.SetSourcePort(source_port);
IRQ7packet.SetDestinationPort(destination_port);
IRQ7packet.AddDataWord(IDENTIFICATION);
IRQ7packet.AddDataWord(IRQ7_FAULT);
}
That being said, I know I run into a privelage violation by calling "IRQ7packet.Send(ipaddr);" from the IRQ function. I tried setting up a task with a priority of "MAIN_PRIORITY - 10" and posting a semaphore, but that doesn't work. Is there a way to manually create and send a packet from within the IRQ7 ISR? My other concern with using a an OS task is that I'll ahve to wait for the current task to complete before the pending semaphore is answered. Anyone got any better ideas? Thanks!