TinyIOx release 0.2.0

http://jbperf.com/io_extender/index.html
http://jbperf.com/io_extender/tinyIOx.html for the TinyIOx

TinyIOx release 0.2.0

Postby jbelanger » Thu Nov 19, 2015 11:26 pm

There is a new firmware release for the TinyIOx. The changes are:

  • Support for up to 8 LED display units (8 x up to 4) on the I2C bus
  • Extend support for SLC OEM to cover sensor temperature and support both LSU 4.2 and 4.9 versions (automatic detection)
  • Generic sensors (9) with calibration tables (4)
  • Serial comm for tuning + CAN passthrough
  • Extended RC servo range (0.5-2.5ms)
  • Add virtual I/Os
  • Change 'AND' condition in programmable on/off outputs to use hysteresis: res = ((val & threshold) == hysteresis)

Some of the changes are a bit more involved than the simple description above.


The code is available here. The zip file contains the new s19 file, ini file and a default msq file. To upgrade, the latest port scanner should be used.

Note: Some issues do exist when using this new TinyIOx firmware with old versions of MS2/Extra: TunerStudio and MS2/Extra older than 3.3.0 are not compatible with loading calibration tables in CAN passthrough.

The LED display support is a result of previous work done on the IOx with Rod S: viewtopic.php?f=9&t=1360. This allows the use of up to 8 display units. One of those units is the Adafruit display (https://www.adafruit.com/products/878 for the red display; other colors are available):

Image

The other units are boards I have designed that are yet to be released. They have four 4-digit displays and come in 0.56" height (same as the Adafruit display) and in the smaller 0.36" height:

Image
(thanks to Rod for the picture)

With my boards, the TinyIOx can display up to 32 different values. I'll come back to what exactly can be displayed.

The other major change is the serial port. It is now possible to use the serial port to communicate between the PC and the TinyIOx for tuning and datalogging. That means that the TinyIOx can be used in a standalone configuration where it will not be connected to the CAN bus to an MS2 or MS3 but will be connected to sensors, LED displays, wideband controllers, and other devices.

By default, the serial port is configured in this "tuning" mode so that a standalone setup can upgrade the firmware and continue to be operational. For those who are using the TinyIOx as a CAN device and need to connect to an Innovate chain (LC-1/LC-2), it will be necessary to change this setting after the code upgrade. Obviously, a standalone setup will not allow the use of the serial port for an Innovate chain.

The code changes have resulted in some changes in the menus. The following will go through these changes with some explanation on how to set and use the new parameters.

Image

The "TinyIOx setup" menu now has a "Serial port settings" item. The picture on the left shows the default settings while the picture on the right shows what to change for using the serial port for an Innovate chain. The baud rates are independently set and should not need to be changed from the default.

Image Image

Since the serial port settings have been set in their own screen, the AFR data settings have been changed slightly. The picture below shows the AFR reading feature disabled.

Image

When configured as a CAN device, the LC-1 AFR settings are the same as they were before.

Image

When configured either as a CAN device or a standalone device, the SLC OEM settings now include an option to read the sensor temperature from the SLC OEM. The temperature is in the datalog and can be displayed on a LED display (as well as the AFR or Lambda value). For an LSU 4.2, the normal operating temperature should be 750 C and for the LSU 4.9, it should be 780 C.

Image

The Extended Control menu and settings remain the same except for the virtual I/Os as will be shown later.

Image

There is a new menu for the LED Displays.

Image

The LED Display settings allow the user to select the type of display connected to the I2C port; it can either be the Adafruit display or one of my boards (QuadLED) shown at the top of the post. For each display, the brightness can be adjusted from 0 to 15 where 0 is the dimmest and 15 the brightest. When the Adafruit display is selected, a single value is displayed and when the QuadLED display is selected, up to 4 values can be displayed.

Image

The possible displayed values are:
  • AFR data
  • SLC OEM sensor temperature
  • Calibrated sensor data
  • RPM
  • Lambda value
  • No data (display turned off)

The calibrated sensor data will be explained next. The RPM value is only available when connected to the CAN bus to an MS2 (with MS2/Extra) or an MS3 (or an ECU based on these 2). The RPM is read from the ECU over the CAN bus.

The 8 displays correspond to the I2C address selected on the displays. Both types of display have 3 address bits (A0-2) that can be selected so the resulting 0-7 addresses correspond to the 1-8 display numbers in the settings. Also, the code assumes that the displays have consecutive addresses starting from 0 without any missing address. So a single display will have to be display 1 at address 0; 2 displays will be at addresses 0 and 1 and displays 1 and 2; and so forth.

The calibrated sensor data is the data from one of the 9 ADC (analog) inputs that has been translated using one of the 4 calibration tables (below in the post). There is also the hardcoded option of using the ADC data as an EGT value; this correspond to an input circuit where 0V = 0C and 5V = 1250C. If another EGT calibration is needed, one of the calibration table will have to be used.

Image

Since the data in the calibration tables has a range of -3276.7 to 3276.7, it is impossible to display the entire range on a 4-digit display. Therefore, it is possible to display the data with 1 decimal value or with no (0) decimal value. With one decimal value, the actual displayed range will be from -99.9 to 999.9 and with no decimal value, the range will be -999 to 3277 (value is rounded up from 3276.7). When the calibrated data is outside the displayable range, the display will show either -9.9.9 or 9.9.9.9. depending on whether the value is negative or positive.

The EGT calibration is hardcoded at no decimal value.

If a calibration has not been chosen for a displayed sensor, the display will show -.-.-.-.

The calibration tables can be uploaded from the Tools menu (TunerStudio adds a "Calibrate TPS" option that is irrelevant and unused with the TinyIOx).

Image

To change the table, it is first necessary to unlock them. They should be locked again once the changes have been made; this will prevent unwanted changes.

Image

Once the tables are unlocked, you will be able to go to the calibration table screen and select which of the 4 tables you want to update.

Image

There are 3 possible types of calibration. The first one is for a NTC thermistor which is what most temperature sensors used on an engine are. The screen is the same one used for the other Megasquirt products and allow the use of predefined sensors or some custom values for a generic thermistor.

Image

The second calibration type is for linear sensors. This only requires entering the voltage and calibrated data for 2 points and TunerStudio will compute the other values. Note that the strange formatting is due to using the same screen for different calibration types.

Image

The last calibration type is the custom calibration. This require the creation of a file that will define the complete calibration curve of the calibration values with respect to the voltage.

Image

Please note that these calibration tables are not saved when updating the firmware nor is the data used to create them. There is also no way to read them back from the TinyIOx at this time. So you will need to note how your tables have been created and you will need to re-upload them after each firmware upgrade. Failure to do so will result in random calibration data.

The last new feature for this new firmware are the virtual I/Os. These are similar to the "Loop" parameters available in MS2/Extra and MS3 but with a wider usage. These can be used in the programmable on/off outputs instead of using actual physical output pins. These can then be used in conditions for other on/off outputs. That allows the use of more than 3 condition to affect the state of an output pin.

Image

It is also possible to use the same virtual I/Os in the digital I/O ports. That way, I/Os on the TinyIOx can be transferred over the CAN bus to and from the ECU without wasting a physical port. If a virtual I/O is used as a channel for an output port, the data from the ECU will be used in another function on the TinyIOx. If it is used as a channel for an input port, the result of another TinyIOx function will transferred to the ECU.

Image

Jean
Image
jbelanger
 
Posts: 3617
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: TinyIOx release 0.2.0

Postby jbelanger » Tue Nov 24, 2015 9:34 pm

As noted in the original post, this new TinyIOx firmware version has issues when used with MS2/Extra releases older than 3.3.0. The MS2/Extra firmware and TunerStudio are not compatible with loading calibration tables to the TinyIOx in CAN passthrough.

At this time, for someone wanting to upload calibration tables the only solution is to either use a more recent MS2/Extra release when using the TinyIOx in CAN passthrough or upload the calibration tables through the TinyIOx serial port. Failure to do so may result in corrupted memory in the TinyIOx which might require reloading the firmware.

No other feature is affected.

Since this is due to external code (MS2/Extra and TunerStudio), nothing can be done to correct the situation and allow loading the calibration tables under conditions mentioned at the top. However, the goal for future releases is to minimize the impact of a failed attempt at loading a calibration table.

Jean
Image
jbelanger
 
Posts: 3617
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: TinyIOx release 0.2.0

Postby dontz125 » Tue Nov 24, 2015 9:48 pm

Just so I'm clear - the only difficulty comes in when loading a custom .inc file to the TIOx, using older MS2 firmware?
dontz125
 
Posts: 199
Joined: Mon Feb 22, 2010 10:27 pm

Re: TinyIOx release 0.2.0

Postby jbelanger » Tue Nov 24, 2015 10:10 pm

dontz125 wrote:Just so I'm clear - the only difficulty comes in when loading a custom .inc file to the TIOx, using older MS2 firmware?

Actually, it's when loading any of the 3 types of calibration tables whether it be for a thermistor, a linear sensor or a custom .inc file. For everything else, the MS2 firmware version has no impact.

I also forgot to mention one other minor issue that is again not due to the TinyIOx firmware. When loading a thermistor calibration table, TunerStudio will always send a calibration that is in degrees Fahrenheit. This is due to the fact that Megasquirt ECUs store their temperature data internally as Fahrenheit degrees. That's not the case with the TinyIOx since it uses the data for displays and it doesn't have excess resources to make units transformations on the fly.

So the workaround to have Celsius degrees displayed with a thermistor is to upload the calibration table using the Celsius temperature for the 3 point calibration but select the Fahrenheit units. This way, TunerStudio will compute and send the table as a Celsius calibration table.

That has no impact on the linear sensor and the custom.ini calibration tables since TunerStudio doesn't assume any units for those so it doesn't make any transformation but just uploads the entered data as-is.

Jean
Image
jbelanger
 
Posts: 3617
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: TinyIOx release 0.2.0

Postby jbelanger » Wed Nov 25, 2015 10:18 pm

Following some pertinent comments, there is a need to add some information on the serial port settings and the actual pinout for the cable.

It should be noted that the state of the serial port is irrelevant when using CAN passthrough. It is only relevant when you have a standalone setup or you need to read LC1 data.

So if you have a TinyIOx-only project in TunerStudio, you can either connect through the serial port or in CAN passthrough (using the MS serial port). You have to connect the port you use (serial or CAN) and set the SERIAL project property accordingly (enabled for the serial port; disabled for the CAN bus).

If you have an MS (MS2/Extra or MS3) project with a TinyIOx as a CAN device, you need to connect the TinyIOx through the CAN bus and disable the SERIAL property.

The pinout for the 2.5mm stereo plug for the cable connecting the TinyIOx to a PC when used in a standalone configuration (or simply using the serial port for tuning/datalogging) is NOT the same as the Innovate cable. Although this is not intuitive since the TinyIOx can directly connect to Innovate devices, the reason is that the TinyIOx plays the role of the PC in this configuration. Therefore, the RX and TX functions are reversed.

The pinout is (on the PC side and on a female DB9 connector):
  • Tip: RX (pin 2 on a DB9)
  • Ring: TX (pin 3 on a DB9)
  • Sleeve: ground (pin 5 on a DB9)

I do have have a few USB-serial adapters with the correct 2.5mm connector and pinout. They will be available for US$12 each. At this time they are in limited supply but I can get more if there is demand for them. Please note that while they work fine on a bench test setup, I have not tested them in a noisy environment but the cable itself is RS232 and the USB part is limited to the USB connector section so it should be less sensitive to noise than a USB cable.

Jean
Attachments
usb_cable_small.jpg
USB-serial cable with 2.5mm connector
usb_cable_small.jpg (78.96 KiB) Viewed 6977 times
Image
jbelanger
 
Posts: 3617
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: TinyIOx release 0.2.0

Postby thedrew » Fri Jul 01, 2016 1:11 am

does this play nice with MS3 1.5 pre alpha 4? When I upgraded the firmware on the M3X box, my ADC0 wasn't reporting correctly and AFR1 (which is through the I2C bus) also wasn't coming into megasquirt correctly.

(maybe my settings need to be changed?)

I just switched back to 1.4.1 beta 5 and everything is working again.
thedrew
 
Posts: 2
Joined: Fri Mar 11, 2016 5:24 pm

Re: TinyIOx release 0.2.0

Postby jbelanger » Wed Aug 03, 2016 8:40 pm

If that comes up again, please post your msq for both the MS3 and IOx (or better yet the whole project backup file). I need to reproduce this to investigate further.

Jean
Image
jbelanger
 
Posts: 3617
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: TinyIOx release 0.2.0

Postby masterx81 » Mon Feb 26, 2018 8:09 am

This code can't be ported to the iox?
I'm interested to connect to the iox the slc oem 4.9 via i2c, and the addition of a display is really nice...
masterx81
 
Posts: 94
Joined: Fri Nov 05, 2010 6:03 am

Re: TinyIOx release 0.2.0

Postby jbelanger » Mon Feb 26, 2018 12:30 pm

Yes it will be ported to the IOx. There is an updated hardware version of the IOx being developed at this time and the firmware will be updated and released at the same time.

Jean
Image
jbelanger
 
Posts: 3617
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: TinyIOx release 0.2.0

Postby masterx81 » Mon Feb 26, 2018 4:06 pm

Wow! Same for the iox-oem?
masterx81
 
Posts: 94
Joined: Fri Nov 05, 2010 6:03 am

Re: TinyIOx release 0.2.0

Postby jbelanger » Mon Feb 26, 2018 4:18 pm

The IOx-OEM will remain the same as it is right now. But the new code will work on it since the new IOx keeps the same CPU as before.

Jean
Image
jbelanger
 
Posts: 3617
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada


Return to I/O Extender

Who is online

Users browsing this forum: No registered users and 3 guests