I developed Arduino code that sends DMX protocol packets over Serial1 (connected to a Rs-486 line driver shield) on the Galileo Gen 1 board.
The DMX standard sends serial data at a rate of 250.000 bit/s with 8n2 format (two stop bits). Before each DMX frame, a break signal must be send, which should be at least a 88us long low level on the line. To achieve this with low delay as possible, I multiplex between the pin 1 mode being configured as output and as serial1 port.
The Arduino setup() routine contains this:
//set low level as default on serial pin for break frame pinMode(1, OUTPUT); digitalWrite(1, LOW); //mux pin 1 to serial mode with DMX speed and 8n2 data format (idle level is high) Serial1.begin(250000);
The in the loop() routine, using the previous Arduino Intel IDE release, the following two statements created a break gap (low level) of about 5.5 ms on pin 1:
Now, since I updated to Arduino-1.5.3-Intel-1.0.4, the low level break gap increased by factor of 8 to about 45 ms! This is not acceptable anymore, because the break gap is now almost twice as large as the DMX data fame itself, so the effective DMX update rate gets very slow.
Note, with the new IDE version I had to exchange muxSelectDigitalPin(1) with muxSelect(1, FN_GPIO_OUTPUT), because the former function disappeared. But I believe this is not the source of the problem.
Do you have any explanation for the extended pin multiplexing times?
Could I improve it by changing something in the Arduino x86 core? I noticed a lot has changed in the core code between the two IDE releases.
For the reference, I modified the Arduino Intel core to be able to send Serial data at 250.000 bit/s with 8n2 format. It can be found here:
Sending a whole DMX frame from an Arduino sketch on the Galileo looks currently like this:
// generate DMX break gap muxSelect(1, FN_GPIO_OUTPUT); muxSelectUart(1); // send empty data: START CODE Serial1.write((uint8_t)0); // write all the channel values from the DMX array Serial1.write(DMXBuffer, sizeof(DMXBuffer));
For further details on DMX please see this nice technical summary: DMX512 | Erwin Rol Software Engineering