Open emitdrop opened 2 years ago
Hi emitdrop, When the M4 is executing C_NETSEND or C_NETRECV it will briefly stop the Z80 via BUSRQ, which could result in a missed interrupt. Thinking about it the NETRECV will run in the background on the ESP8266 and once it gets data it will interrupt the Z80 briefly to transfer the data to the ARM mcu which in turn makes it available for the Z80 adressing space. The interruptions will be very brief but at the wrong moment it would make you miss an interrupt. Probably it would be safest to not run them from interrupt routines.
Regards, Duke
Hi Duke,
Thank you very much for such a detailed explanation. Everything is very clear to me.
Following your advice, it would be best to do some kind of non-blocking receive check in the main loop and leave the interrupt only to update a flag of when such a check should be done, that is, to control how often it should actually be executed.
I'll have to be very careful to save the most sensitive registers on the stack before calling receive, which will be quite a few, but that's up to the implementation.
Regards, Emitdrop
Hi Duke,
Is there any special consideration that I have to take into account (or prohibition) to use the pair C_NETSEND / C_NETRECV inside an interrupt?
I'm designing a keep alive mechanism, and I need to send every minute or so 2 bytes to the server and wait for its ack.
I have been able to verify that the C_NETSEND works correctly inside the interrupt, but the server message is never available when I ask for it in the status socket (inside the same interrupt).
However, if I do this outside of an interrupt (in the main loop) it works fine: send "ping" and receive "pong".
Probably this whole keep alive loop isn't suitable for an interrupt, but before I rule it out I wanted to see if you had any limitations by design.
Many thanks