Page 1 of 2

Connectivity overview & build-in commands

Posted: Mon Oct 21, 2013 1:43 am
by AndreyB
A LOT OF OUTDATED INFORMATION HERE


http://rusefi.com/wiki/index.php?title=Development:Software:connectivity

http://rusefi.com/wiki/index.php?title=Manual:Software:dev_console_commands

rusefi firmwave currently supports two protocols for ECU monitoring & control
1) human-readable native protocol - connect to the ECU using HyperTerminal or putty or our own java dev console.
2) TunerStudio protocol for integration with http://www.tunerstudio.com/ tuning software

Both protocols can run either via the build-in USB controller (microUSB connection on the discovery board) or via USART working with a USB TTL device like http://rusefi.com/articles/tachometer_ts/uart.jpg

Two protocols cannot coexist on the same serial port, so in order to have both protocols you need to have two serial ports connected to the brain board at the same time, this is achieved by using build-in USB controller and a USB TTL module simultaneously.


Grounding pin PB1 controls which protocol uses which hardware.
No PB1<>GND jumper on startup: console is on USB.
With PB1<>GND jumper on startup: console is on UART.


By default we use USART3. TX is pin PC10 & RX is PC11

That's unless we are running build-in serial-over-USB (micro-USB in our case). Sometimes we have both at the same time, it's just that depending on the features.h either one or another is using the micro-USB while the other uses USART pins.

ST serial-over-usb driver is located at http://www.st.com/web/en/catalog/tools/PF257938

Here is a brief overview of the human-readable native protocol command. Just open your terminal application and start typing!
hello
prints the version of firmware
help
prints the list of supported commands


showconfig
Shows current configuration stored in the flash memory - that's where you can see your current fuel map etc.

resetconfig
Resets configuration to default

writeconfig
Write config to flash (you only need this if you have used one of the 'setXXX' commands)

tsinfo
Prints TunerStudio communication summary

rpm <new value>
For example
rpm 1200
Sets the RPM for build-in position sensor simulator

tempinfo
prints out some debug information on CLT and IAT sensors

Re: Connectivity overview & build-in commands

Posted: Sat Nov 16, 2013 2:42 pm
by jedediah_frey
russian wrote:Oh, by the way by default we use USART3. TX is pin PC10 & RX is PC11
For the 'human readable' part would you be interested in more of a 'live console' approach?

I've dug through the console function and figured out how to bind to arrow keys and the like.

It'd be something similar to:
(But nowhere near as advanced right now). But what it would allow you to do is see a bunch of values live updated through console (if you didn't want to use TunerStudio)

Re: Connectivity overview & build-in commands

Posted: Wed Dec 25, 2013 6:27 am
by AndreyB
New command:

set engine_type [engine_config_id]
For example,

Code: Select all

set engine_type 2
Would change the configuration to the default Dodge Neon configuration. The IDs are visible in engines.h

You should reboot the firmware after changing engine type - hit the reset button or just power off/on the microcontroller.

Image

Re: Connectivity overview & build-in commands

Posted: Mon Dec 30, 2013 6:39 pm
by AndreyB
fl 0

Turns-off constant dev console data output. fl 1 would turn it back on. ('fl' stands for 'full logging')

Re: Connectivity overview & build-in commands

Posted: Sun Jan 12, 2014 7:26 pm
by AndreyB
fuelbench ON_TIME OFF_TIME COUNTER

for example, fuelbench 4.1 5.8 60000

This command would send out a series of on/off squirts out to injector #1, this could be used while testing something like injector output

Code: Select all

Running fuel bench: ON_TIME=4.09999, OFF_TIME=5.80000. Counter=60000
INJECTOR_1_OUTPUT on PB9

Re: Connectivity overview & build-in commands

Posted: Wed Jan 15, 2014 6:11 pm
by AndreyB
New commands:
set_injection_pin_mode MODE
set_ignition_pin_mode MODE
set_idle_pin_mode MODE
set_fuel_pump_pin_mode MODE
set_malfunction_indicator_pin_mode MODE


For example,
set_idle_pin_mode 1

Currently four modes are supported:
OM_DEFAULT = 0 (GND for logical OFF, VCC for logical ON)
and
OM_INVERTED = 1 (GND for logical ON, VCC for logical OFF)

OM_OPENDRAIN = 2
OM_OPENDRAIN_INVERTED = 3

open drain modes should be added soon

Re: Connectivity overview & build-in commands

Posted: Wed Jan 15, 2014 10:08 pm
by AndreyB
acab wrote:For that command promt i need USB-SD module?
No, all you need is a micro-USB cable.
acab wrote:Can i try write simple DOTNET application for Tuning rusEFI?
Do you realize that we have a simple java application for tuning rusEfi? It's the dev console. Feel free to improve it. But you can absolutely write a totally new one using .NET if you choose to do so.

Re: Connectivity overview & build-in commands

Posted: Fri Jan 17, 2014 12:53 am
by AndreyB
Can someone please confirm that I am right:
in open_drain, logical 0 is floating and logical 1 is GND, right?

Re: Connectivity overview & build-in commands

Posted: Fri Jan 17, 2014 5:26 am
by Sergey89
Yes. Control logic is inverted and the output is high in the default state.

Re: Connectivity overview & build-in commands

Posted: Mon Jan 20, 2014 9:30 am
by puff
what's the default baud rate and parity settings? don't know how to set up my bluetooth HC-06 module to 115000
UPD. found it - #define SERIAL_SPEED 115200 (in features.h)

Re: Connectivity overview & build-in commands

Posted: Mon Jan 20, 2014 2:08 pm
by puff
Weird stuff. I just set my BT module to 115000 baud rate. It passed the internal test of the TunerStudio. However, when I open the project with that rusefi.ini file, after three attempts it pops up with the following message:
Error reading data from after 3 attempts
Error message returned:
Serial Failure, Unable to get all pages of data after multiple attempts.
Application will now go offline, etc…
I tried to open that port directly from my console, using screen command, typing 'help' returned nothing, although when I press uppercase 'H' (with shift) it returns 'MShift v0.01'. I checked other keystrokes. Seems, the only other symbol is 't' or 'T', which return 'Alive' with CR

upper 'O' gives back an unreadable string '�(�B"�A���?��IA@A��z�'

Re: Connectivity overview & build-in commands

Posted: Mon Jan 20, 2014 2:13 pm
by AndreyB
I bet that what you are experiencing is a mismatch between the rusefi.ini version and the firmware version. Also, at some point there was a bug related to reading the whole tune.

A simple way to test would be to use 'tsinfo' command on the human-readable port - it would tell you the data structure size. This size should match the size in rusefi.ini. Right now the size is 2992. If one of your sizes is not 2992, I think you need to get the latest version - do you compile from SVN trunk?

Re: Connectivity overview & build-in commands

Posted: Mon Jan 20, 2014 2:28 pm
by puff
Man! I just used the .elf file that you gave me yesterday. The .ini file for the tuner studio is from firmware rusefi.r1008.
May be TS is buggy? Mine is 2.0.4 - or 2.5.05 - I didn't get it.
as for 'tsinfo' command - it returns the same 'alive' response, no matter whether I try typing it in the console symbol by symbol or paste the whole buffer…

Re: Connectivity overview & build-in commands

Posted: Mon Jan 20, 2014 6:25 pm
by AndreyB
Q: what does this error message mean?
Image

A: it means you are connecting Tuner Studio to human-readable protocol. You need to either use another version of the firmware with different serial mapping or use a USB TTL device and install the second serial port. I did mention that we use two protocols couple of times, right? :)

Re: Connectivity overview & build-in commands

Posted: Mon Jan 20, 2014 6:30 pm
by puff
As for my problem, updating the rusefi.ini file helped me solve it, thanks a lot! It works just fine, though, air/fuel gauge is wobbling at 12,5-12,8 with no sensors connected :geek:

Still a bit confused with all those serial ports. Does it mean in this setup Discovery board has two pairs of pins for two different serial ports? Right now I am using PD8/PD9 for TunerStudio, and it's not human-readable. Does it mean, human readable port is on microusb? Why do I need a USB TTL device, why not use microusb port directly? As far as I know, there are implementations of serial-over-usb.

Re: Connectivity overview & build-in commands

Posted: Mon Jan 20, 2014 6:57 pm
by AndreyB
puff wrote:Still a bit confused with all those serial ports...
Yes human readable port is on microusb. Yes two serial ports - with separate purposes. TS is better for tuning, HR (human-readable) is better for development. We are in the development phase so the convenient microusb is used for HR.

Re: Connectivity overview & build-in commands

Posted: Thu Jan 23, 2014 2:54 pm
by AndreyB
New command: cranking fuel adjustment

set_cranking_fuel_min TIME_MS TEMP_C
set_cranking_fuel_max TIME_MS TEMP_C


For example
set_cranking_fuel_min 20 0
Would mean that at and below 0C we should inject fuel for 20ms

We need more fuel while engine cranking, current implementation uses linear interpolation based on two point - 'min temperature' point and 'max temperature' point. The temperatures are in C.

Re: Connectivity overview & build-in commands

Posted: Fri Feb 14, 2014 3:44 am
by AndreyB

Re: Connectivity overview & build-in commands

Posted: Fri Feb 21, 2014 1:32 am
by AndreyB
help command now works in dev console

Re: Connectivity overview & build-in commands

Posted: Tue Feb 25, 2014 2:20 am
by AndreyB
Because of Frankenstein layout, Tuner Studio default pins are now different: TX is pin PC10 & RX is PC11

Re: Connectivity overview & build-in commands

Posted: Sun Mar 02, 2014 7:25 pm
by AndreyB
I will now move part of the posts into http://rusefi.com/forum/viewtopic.php?t=493

Re: Connectivity overview & build-in commands

Posted: Sun Mar 02, 2014 10:57 pm
by E4ODnut
I got this list using Hyper Terminal and typing "help". I've added the descriptions I could find. Are there descriptions available for the ones I've missed?

msg, help: 0 parameters, prints the list of supported commands
msg, echo: 1 parameters,
msg, hello: 0 parameters, prints the version of firmware
msg, fatal: 0 parameters,
msg, ths: 0 parameters,
msg, showconfig: 0 parameters, Shows current configuration stored in the flash memory - that's where you can see your current fuel map etc.
msg, readconfig: 0 parameters,
msg, writeconfig: 0 parameters, Write config to flash (you only need this if you have used one of the 'setXXX' commands)
msg, resetconfig: 0 parameters, Resets configuration to default
msg, date_get: 0 parameters,
msg, date_set: 3 parameters,
msg, date_help: 0 parameters,
msg, adcDebug: 1 parameters,
msg, adc: 1 parameters,
msg, fadc: 0 parameters,
msg, sdinfo: 0 parameters,
msg, mountsd: 0 parameters,
msg, appendToLog: 3 parameters,
msg, umountsd: 0 parameters,
msg, ls: 3 parameters,
msg, gpsinfo: 0 parameters,
msg, i2c: 5 parameters,
msg, sfm: 5 parameters,
msg, fl: 1 parameters, Turns-off constant dev console data output. fl 1 would turn it back on. ('fl' stands for 'full logging')
msg, status: 0 parameters,
msg, set_ignition_offset: 1 parameters,
msg, set_global_trigger_offset_angle: 1 parameters,
msg, set_analog_chart_mode: 1 parameters,
msg, set_fixed_mode_timing: 1 parameters,
msg, set_timing_mode: 1 parameters,
msg, set_engine_type: 1 parameters, Would change the configuration to the default Dodge Neon configuration.
You should reboot the firmware after changing engine type - hit the reset button or just power off/on the microcontroller.
msg, set_injection_pin_mode: 1 parameters,
msg, set_ignition_pin_mode: 1parameters,
msg, set_idle_pin_mode: 1 parameters, For example, set_idle_pin_mode 1

Currently four modes are supported:
OM_DEFAULT = 0 (GND for logical OFF, VCC for logical ON)
and
OM_INVERTED = 1 (GND for logical ON, VCC for logical OFF)

OM_OPENDRAIN = 2
OM_OPENDRAIN_INVERTED = 3
msg, set_fuel_pump_pin_mode: 1 parameters,
msg, set_malfunction_indicator_pin_mode: 1 parameters,
msg, set_rpm_multiplier: 1 parameters,
msg, set_cranking_fuel_min: 5 parameters, For example set_cranking_fuel_min 20 0
Would mean that at and below 0C we should inject fuel for 20ms
We need more fuel while engine cranking, current implementation uses linear interpolation based on two point - 'min temperature' point and 'max temperature' point. The temperatures are in C.
msg, set_cranking_fuel_max: 5 parameters,
msg, chartsize: 1 parameters,
msg, chart: 1 parameters,
msg, wm: 5 parameters,
msg, tsinfo 0 parameters, Prints TunerStudio communication summary
msg, injector: 5 parameters,
msg, gfc: 1 parameters,
msg, fuelbench: 4 parameters, for example, fuelbench 4.1 5.8 60000This command would send out a series of on/off squirts out to injector #1, this could be used while testing something like injector output
msg, faststat: 0 parameters,
msg, trigger_hist: 0 parameters,
msg, tempinfo: 0 parameters, prints out some debug information on CLT and IAT sensors
msg, testmath: 1 parameters,
msg, rpm: 1 parameters, For example, rpm 1200 sets the RPM for build-in position sensor simulator

Re: Connectivity overview & build-in commands

Posted: Sun Mar 02, 2014 11:07 pm
by AndreyB
Robert, this is pretty helpful!

I've started a wiki page for all the commands - I've added a couple more descriptions: http://rusefi.com/wiki/index.php?title=Manual:Software:dev_console_commands

Re: Connectivity overview & build-in commands

Posted: Sun Mar 02, 2014 11:36 pm
by E4ODnut
Good. Glad to be of assistance. I see your additions so I'll play around with them.

I've also written up a bit of a ".hex file loading cheat sheet" for my own use, but maybe it could be incorporated into some more comprehensive instructions.

How to get and load the latest rusEFI .hex file:

1: - Go to the rusEFI.com web site

2: - Click the “Manual-Software” button. This brings up a software manual page. In the line of text “once you get the brain board you will need to program it with the rusEFI firmware binary file. More about that here”.

3: - Click “here” link. This brings you to the thread “Setting up the board with pre-compiled binaries” This thread has instructions on how to download and use the STM32 ST-Link Utility with which to load the .hex file into Discovery.

4: - In the first line in the first post of the thread, click the “build-server” link. This brings up a link to the rusEFI consol.jar and rusEFI firmware.zip.

rusEFI consol is a utility that you can use to communicate with Discovery. It can live at whatever location you download it to. A shortcut on your desktop will allow you to run it from your desktop.

rusEFI firmware.zip contains the latest firmware .hex file and configuration settings for Tuner Studio. Create a folder for rusEFI stuff and unzip it here.

5: - To load the file into Discovery connect both the power and communication USB cables to your computer. Open the STM32 ST-Link Utility. Go to “File” . “Open” and select the .hex file in your rusEFI folder. Click the “Program and Verify” button. The process takes several seconds and if successful will report so on the screen.

That’s it.

Re: Connectivity overview & build-in commands

Posted: Sun Mar 02, 2014 11:48 pm
by AndreyB
The Manual:Software link is probably gone now, but it is replaces by a better 'wiki - Soft U Manual' link in the left navigation pane of www.rusefi.com

miniUSB is both power and programming. micorUSB is only dev console communication, without the power.

Re: Connectivity overview & build-in commands

Posted: Mon Mar 03, 2014 1:40 am
by kb1gtt
Looks like we broke his instructions. Hopefully this helps.

Load firmware is now assimilated http://rusefi.com/wiki/index.php?title=Manual:Software:User/en#Load_firmware
Dev Console is now assimilated http://rusefi.com/wiki/index.php?title=Manual:Software:User/en#Dev_Console

Re: Connectivity overview & build-in commands

Posted: Mon Mar 10, 2014 1:18 am
by AndreyB
tss renamed to tsinfo
new command - lcdinfo

Re: Connectivity overview & build-in commands

Posted: Sun Mar 16, 2014 7:17 pm
by AndreyB
analoginfo
Brief analog inputs report. This command reports voltage taking current divider settings into account.

Image

Re: Connectivity overview & build-in commands

Posted: Thu Jun 12, 2014 12:22 pm
by AndreyB
It is now possible to control which protocol would be activated on microUSB, and which one would be activated on the UART:
reset while not holding the blue button - dev console would be using USB and TunerStudio would be using UART
hold the blue button while resetting - TunerStudio would be activated on the USB and dev console on the UART

Re: Connectivity overview & build-in commands

Posted: Thu Jun 19, 2014 11:46 pm
by acab
By default we use USART3. TX is pin PC10 & RX is PC11
you sure?

Code: Select all

firmware / config / boards / arro_board.h

#define EFI_CONSOLE_UART_DEVICE (&SD3)
#define EFI_CONSOLE_TX_PORT GPIOC
#define EFI_CONSOLE_TX_PIN 10
#define EFI_CONSOLE_RX_PORT GPIOC
#define EFI_CONSOLE_RX_PIN 11
#define EFI_CONSOLE_AF 7 

#define TS_SERIAL_TX_PORT GPIOC
#define TS_SERIAL_TX_PIN 10
#define TS_SERIAL_RX_PORT GPIOC
#define TS_SERIAL_RX_PIN 11
#define TS_SERIAL_AF 7