Suspending asynchronous serial communication to send a single trigger pulse
I am working on a project where the reading of an AD converter is transferred asynchronously via power line communication. A Propeller P1 is handling the input to the power line modem. The data rate is low, just 600 bit/sec.
It works essentially fine using the “FullDuplexSerial.spin” or “jm_hd485.spin” object (for half duplex communication). The problem is now that the communication needs to be interrupted to let a single pulse pass which serves as a trigger for a seismic recorder. Afterwards the transfer of the AD converter readings should resume.
I have used the “stop” function of the serial objects to pause the communication, used some Spin code to generate the trigger pulse and started the serial objects again. This worked also fine.
But since the trigger pulse is rather time critical I tried to replace the Spin code by PASM instructions in a separate Cog. The function of this code is finally to observe one pin of the P1 and send the trigger pulse over the communication pin as soon as the observed pin goes high.
I have noticed now that the communication after a trigger interruption is somehow instable. In a few cases the AD converter readings are transferred but in most cases it doesn’t work or the numbers are disturbed.
The attached short spin file illustrates how I manage the interruption. It uses the programming pins to communicate to simplify the example. But it is my fist trial in PASM and I maybe overlook something essential. The spin file is capable of running but it crashes in the second loop, sometimes already after the first pulse. It behaves somehow erratic.
I would be grateful if someone who has time and is in the mood has a look at the code and give some advice. Maybe there is a possibility to keep the cog of the serial object running during sending the pulse so that not a new cog needs to be started every time after the interruption.