The Arduino Mega2560 version of Speeduino supports the use of Serial3 for supplemetry IO.
The STM32F4XX and Teensy3.5/6 versions use Serial2 .
On a Mega 2560 Serial3 can be found on the board at pins 14 and 15.The connection speed is 115200baud.
Supplementry IO via Canbus is under development for Teensy and Mega2560 mcu types.
The use of canbus will also enable more advanced features to be added in the future.
To enable use of the Secondary io interface it must be enabled in TunerStudio.
Dependant on if CAN_COMMANDS have been enabled will vary the type of dropdown menu you will see
select option "Secondary Serial IO Interface" or "CanBus/Secondary Serial IO Interface" as appropriate.
Again dependant on if CAN_COMMANDS have been enabled will vary what options you have to enable Secondary serial.
Depending on if the secondary port is a simple serial port or is a canbus port there are several things that the Secondary io interface is capable of.
A Serial port offers ,
A Canbus port offers ,
To get Speeduino to send out the realtime data to your device connected on a Secondary Serial IO port you must send either an "A", an "n" or an "r" to it.
If you send an "A" to the port it will reply with ,
The "A" command data set will not be changed or expanded upon and is maintained for legacy devices.
Designers of new devices are recommended to use the newer "n" command to enable use of any additonal realtime data available beyond the orignal 75 This command supports.
If you send an "n" to the Serial port it will reply with,
if you send an "r" to the port you must also send 6 further additional bytes immediately after the "r".
These are the Speeduino TS canID,
The r type command 0x30(48 in decimal),
A 2 byte offset and a 2 byte length. the offset is the position in the realtime list you want the data returned to start from and the 2 byte length is the number of bytes you want returned. the bytes are sent LSB first .
The port will reply with ,
As of 23/02/2020 the data list is as follows
BIT 0 - currentStatus.secl
secl is simply a counter that increments each second
1 - currentStatus.squirt
Squirt Bitfield
2 - currentStatus.engine
Engine Status Bitfield
3 - (byte)(divu100(currentStatus.dwell))
Dwell in ms * 10
4 - lowByte(currentStatus.MAP)
5 - highByte(currentStatus.MAP)
6 - (byte)(currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET)
mat
7 - (byte)(currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET)
Coolant ADC
8 - currentStatus.batCorrection
Battery voltage correction (%)
9 - currentStatus.battery10
battery voltage
10 - currentStatus.O2;
primary O2
11 - currentStatus.egoCorrection
Exhaust gas correction (%)
12 - currentStatus.iatCorrection
Air temperature Correction (%)
13 - currentStatus.wueCorrection
Warmup enrichment (%)
14 - lowByte(currentStatus.RPM)
rpm LB
15 - highByte(currentStatus.RPM)
rpm HB
16 - currentStatus.TAEamount
acceleration enrichment (%)
17 - currentStatus.corrections
Total GammaE (%)
18 - currentStatus.VE
Current VE 1 (%)
19 - currentStatus.afrTarget
chosen afr target
20 - lowByte(currentStatus.PW1);
Pulsewidth 1 multiplied by 10 in ms. Have to convert from uS to mS.
21 - highByte(currentStatus.PW1);
Pulsewidth 1 multiplied by 10 in ms. Have to convert from uS to mS.
22 - currentStatus.tpsDOT
TPS DOT
23 - currentStatus.advance
Current spark advance
24 - currentStatus.TPS
TPS (0% to 100%)
25 - lowByte(currentStatus.loopsPerSecond)
loops per second LB
26 - highByte(currentStatus.loopsPerSecond)
loops per second HB
27 - lowByte(currentStatus.freeRAM)
freeRam LB
28 - highByte(currentStatus.freeRAM)
freeRam HB
29 - currentStatus.boostTarget
Target boost pressure
30 - currentStatus.boostDuty
current pwm boost dutycycle
31 - currentStatus.spark
Spark related bitfield
32 - lowByte(currentStatus.rpmDOT)
rpmDOT must be sent as a signed integer
33 - highByte(currentStatus.rpmDOT)
rpmDOT HB
34 - currentStatus.ethanolPct
Flex sensor value (or 0 if not used)
35 - currentStatus.flexCorrection
Flex fuel correction (% above or below 100)
36 - currentStatus.flexIgnCorrection
Ignition correction (Increased degrees of advance) for flex fuel
37 - currentStatus.idleLoad
idleload
38 - currentStatus.testOutputs
testoutputs bitfield
39 - currentStatus.O2_2
Second O2
40 - currentStatus.baro
Barometer value
41 - lowByte(currentStatus.canin[0]);
42 - highByte(currentStatus.canin[0]);
43 - lowByte(currentStatus.canin[1]);
44 - highByte(currentStatus.canin[1]);
45 - lowByte(currentStatus.canin[2]);
46 - highByte(currentStatus.canin[2]);
47 - lowByte(currentStatus.canin[3]);
48 - highByte(currentStatus.canin[3]);
49 - lowByte(currentStatus.canin[4]);
50 - highByte(currentStatus.canin[4]);
51 - lowByte(currentStatus.canin[5]);
52 - highByte(currentStatus.canin[5]);
53 - lowByte(currentStatus.canin[6]);
54 - highByte(currentStatus.canin[6]);
55 - lowByte(currentStatus.canin[7]);
56 - highByte(currentStatus.canin[7]);
57 - lowByte(currentStatus.canin[8]);
58 - highByte(currentStatus.canin[8]);
59 - lowByte(currentStatus.canin[9]);
60 - highByte(currentStatus.canin[9]);
61 - lowByte(currentStatus.canin[10]);
62 - highByte(currentStatus.canin[10]);
63 - lowByte(currentStatus.canin[11]);
64 - highByte(currentStatus.canin[11]);
65 - lowByte(currentStatus.canin[12]);
66 - highByte(currentStatus.canin[12]);
67 - lowByte(currentStatus.canin[13]);
68 - highByte(currentStatus.canin[13]);
69 - lowByte(currentStatus.canin[14]);
70 - highByte(currentStatus.canin[14]);
71 - lowByte(currentStatus.canin[15]);
72 - highByte(currentStatus.canin[15]);
73 - currentStatus.tpsADC
TPS (Raw 0-255)
74 - getNextError()
Error codes
To get Speeduino to read analog data over the Secondary Serial Port you must enable it. this is done in TS on an per channel basis.
You set the Source Can address(this is the address of the remote device that you wish to source the data value from.This is not used in direct Serial3 connections), input start byte number,input parameter number of bytes according to the sensor being accessed. Once enabled and configured Speeduino will periodically poll for that device on Serial3
Using Example 1 this is how to get your remote device to reply to the request from Speeduino for data.
Speeduino will issue an "R" request for the Can address selected for the Can input channel.
Speeduino will now await the response.
The remote device upon hearing its ID requested will respond to the Speeduino(at the address that was sent in the outgoing packet) with the Can input channel and 8 bytes of data.It is recommended that the Data you wish to send is placed in bytes 0 and 1 (LSB and MSB respectively)if it is two bytes long or in byte 0 if it is only a single byte long, but the data can be placed in any of the data bytes(just ensure that Speeduino is configured to read those bytes in the config table above.
The value sent is readable in Tunerstudio using the CanIN gauges