× You're looking at the old version of the wiki! As of January 2020, all pages have been migrated to the new site at: http://wiki.speeduino.com

Changes

Jump to: navigation, search

Secondary Serial IO interface

7,034 bytes added, 3 years ago
Created page with "== Overview == The Arduino Mega2560 version of Speeduino supports the use of Serial3 for supplemetry IO.The proposed STM32 and Teensy3.5 versions use Serial2 . On a Mega 2560..."
== Overview ==
The Arduino Mega2560 version of Speeduino supports the use of Serial3 for supplemetry IO.The proposed STM32 and Teensy3.5 versions use Serial2 .
On a Mega 2560 Serial3 can be found on the board at pins 14 and 15.The connection speed is 115200baud.

== Settings ==

* '''Enable Secondary IO interface''' - To enable use of the Secondary io interface it must be enabled in TunerStudio.
[[File:Ts_serial3.jpg|200px|center|]]

This will open a new window where you can switch Serial3 on and off.
[[File:Serial3_interface_enable.png|400px|center|]]
== How to use it ==

There is two things that the Secondary io interface is capable of
* 1. Broadcast the current realtime data just as is sent to TunerStudio.
* 2. Read in the Analog data values from 8 remote sensors.

== Broadcast realtime data ==

To get Speeduino to send out the realtime data to your device connected on Serial3 you must send a "A" to it.
It will reply with ,

"A" confirming the received instruction (sent as 0x41 in hex),

It will now transmit a single byte in hex ,this is the number of bytes it is about to send .This is currently 0x39 (57 in decimal).

It will then transmit the realtime data.

As of 02/05/2017 the data list is as follows

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 - (byte)(currentStatus.MAP >> 1)
map value is divided by 2
5 - (byte)(currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET)
mat
6 - (byte)(currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET)
Coolant ADC
7 - currentStatus.tpsADC
TPS (Raw 0-255)
8 - currentStatus.battery10
battery voltage
9 - currentStatus.O2;
primary O2
10 - currentStatus.egoCorrection
Exhaust gas correction (%)
11 - currentStatus.iatCorrection
Air temperature Correction (%)
12 - currentStatus.wueCorrection
Warmup enrichment (%)
13 - lowByte(currentStatus.RPM)
rpm LB
14 - highByte(currentStatus.RPM)
rpm HB
15 - currentStatus.TAEamount
acceleration enrichment (%)
16 - currentStatus.baro
Barometer value
17 - currentStatus.corrections
Total GammaE (%)
18 - currentStatus.VE
Current VE 1 (%)
19 - currentStatus.afrTarget
chosen afr target
20 - (byte)(currentStatus.PW1 / 100)
Pulsewidth 1 multiplied by 10 in ms. Have to convert from uS to mS
21 - currentStatus.tpsDOT
TPS DOT
22 - currentStatus.advance
Current spark advance
23 - currentStatus.TPS
TPS (0% to 100%)
24 - lowByte(currentStatus.loopsPerSecond)
loops per second LB
25 - highByte(currentStatus.loopsPerSecond)
loops per second HB
26 - lowByte(currentStatus.freeRAM)
freeRam LB
27 - highByte(currentStatus.freeRAM)
freeRam HB
28 = currentStatus.batCorrection
Battery voltage correction (%)<br />
29 = currentStatus.spark
Spark related bitfield
30 = currentStatus.O2_2
Second O2
31 = lowByte(currentStatus.rpmDOT)
rpmDOT must be sent as a signed integer
32 = highByte(currentStatus.rpmDOT)
rpmDOT HB
33 = currentStatus.ethanolPct
Flex sensor value (or 0 if not used)
34 = currentStatus.flexCorrection
Flex fuel correction (% above or below 100)
35 = currentStatus.flexIgnCorrection
Ignition correction (Increased degrees of advance) for flex fuel
36 = getNextError()
Error codes
37 = currentStatus.boostTarget
Target boost pressure
38 = currentStatus.boostDuty
current pwm boost dutycycle
39 = currentStatus.idleLoad
idleload
40 = currentStatus.testOutputs
testoutputs bitfield
41 = lowByte(currentStatus.canin[0])
Can input 0 LB
42 = highByte(currentStatus.canin[0])
Can input 0 HB
43 = lowByte(currentStatus.canin[1])
Can input 1 LB
44 = highByte(currentStatus.canin[1])
Can input 1 HB
45 = lowByte(currentStatus.canin[2])
Can input 2 LB
46 = highByte(currentStatus.canin[2])
Can input 2 HB
47 = lowByte(currentStatus.canin[3])
Can input 3 LB
48 = highByte(currentStatus.canin[3])
Can input 3 HB
49 = lowByte(currentStatus.canin[4])
Can input 4 LB
50 = highByte(currentStatus.canin[4])
Can input 4 HB
51 = lowByte(currentStatus.canin[5])
Can input 5 LB
52 = highByte(currentStatus.canin[5])
Can input 5 HB
53 = lowByte(currentStatus.canin[6])
Can input 6 LB
54 = highByte(currentStatus.canin[6])
Can input 6 HB
55 = lowByte(currentStatus.canin[7])
Can input 7 LB
56 = highByte(currentStatus.canin[7])
Can input 7 HB


== Read external analog data ==
To get Speeduino to read analog data over Serial3 you must enable it. this is done in TS on an per channel basis.

[[File:Canbus_input_config.jpg|800px|center|]]

You then set the input parameter group,input start byte number and input parameter number of bytes according to the sensor being accessed.
Once enabled and configured Speeduino will periodically poll for that device on Serial3

The IO on Serial3 follows a similar protocol format to that of J1939 , this makes looking up a sensors configuration details quite straight forward.

Example 1:
Sensor type : Engine oil Temperature
parameter group = 65262
start byte = 1
number of bytes = 1

Example 2:
sensor type : Engine oil pressure
parameter group = 65263
start byte = 4
number of bytes = 1

Example 3:
sensor type : Exhaust temperture port 1
parameter group = 65187
start byte = 1
number of bytes = 2

Example 4:
sensor type : Exhaust temperature port 3
parameter group = 65263
start byte = 5
number of bytes = 2


Using Example 1 this is how to get your remote device to reply to the request from Speeduino for data.

Speeduino will send an "R"

Followed by the device parameter group number(this is sent in two bytes LSB first)


Speeduino will now await the response.

You must first send an "G" ,

Then send 8 bytes of data. 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 .

The value sent is readable in Tunerstudio using the CanIN gauges
125
edits

Navigation menu