[README] Setting up the board with pre-compiled binaries

User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Setting up the board with pre-compiled binaries

Post by AndreyB »

There were no releases yet - all the changes to the source code are automatically compiled and available at our build_server folder.

You would need to download rusefi_bundle.zip - that's an archive which contains the .hex file you would program into the microcontroller and current TunerStudio project definition.

To upload the binary image into the microcontroller you will need to download & install STM32 ST-LINK utility. At this point you only need the mini-USB cable, this cable would be used both to power and to program the board.

Image

You should click 'Target'>'Program...', browse to the rusefi.hex you have downloaded and hit Start button like this
Image

After you have programmed the chip, you should click 'Target'>'Disconnect' and hit the black button on the discovery STM32F407G-DISC1 board to reset the firmware. After you hit the reset button, you should expect all four LEDs to blink once and then you should see just the blue LED blinking.

Now it's time to connect the micro USB cable. When you do this for the first time your Windows would prompt for drivers, you should download & install http://www.st.com/web/en/catalog/tools/PF257938

When the driver is installed & the board is connected via the micro USB cable, you can verify serial connectivity by opening your Device Manager - we are expecting to see a Virtual COM Port
Image

At this point you are all set with the firmware and it's time to launch the dev console
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
Sergey89
contributor
contributor
Posts: 839
Joined: Wed Sep 25, 2013 5:30 pm
Location: Russia, Velikiy Novgorod

Re: Q&A on how to compile the code

Post by Sergey89 »

ST-LINK utility also has a CLI version.

Code: Select all

ST-LINK_CLI.exe -c SWD -P rusefi.hex 0x08000000 -Rst -Run
You will see some files like flash.bat which use this appoach
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

One of the ways to connect to the firmware is using terminal software like putty

In putty, you need to select 'Serial' and set speed to 115200
Image

If you have pl2303 TTL the driver is at
http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

When you have confirmed serial connectivity with putty, next step step is to validate java development console connectivity.

1) download http://svn.code.sf.net/p/rusefi/code/trunk/java_console_binary/java_console_binary.zip
2) on the discovery board, connect pin PD4 with PC6. Pin PD4 is the source of simulated position sensor signal, pin PC6 is the primary position sensor input port. when you connect these pins together, you should see some non-zero rpm values in putty.
3) disconnect putty to free the serial port
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Setting up the board with pre-compiled binaries

Post by jedediah_frey »

I wrote a short .bat file to and associated it with .hex files.

Code: Select all

@echo off
"C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility\ST-LINK_CLI.exe" -c SWD HOTPLUG -P %1 -Rst
pause
I put that into stFlash.bat and double clicked on the .hex file. I pointed windows to the .bat file and said "Always open with this program". If .hex is already associated with something else (and you want to change it) right click and go down to "Properties" and click on "Change" next to "Opens With".

I also associated it with .bin files. So now I can just double click on a .hex or .bin and it'll flash to the ST board.
User avatar
hasse.69
donator
donator
Posts: 77
Joined: Wed Dec 04, 2013 3:34 pm
Location: Sweden Linkoping/Vadstena

Re: Setting up the board with pre-compiled binaries

Post by hasse.69 »

I had do do it the other way around.
First download the drivers for STM.
Then connect and flash the board.
It worked!
I don´t know if it´s a mix up or i´m just plain stupid.(Dont answer that :D )
I´m onboard now.
But still no Rock´n Roll i cant get to the STM.
It flashed alright but now i cant connect to it.
I can flash but not connect via Tunerstudio
"Electronically challenged of the world, unite!"
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

hasse.69 wrote: I can flash but not connect via Tunerstudio
There are some troubleshooting hints at http://rusefi.com/forum/viewtopic.php?f=5&t=210

Need more info to help you :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
hasse.69
donator
donator
Posts: 77
Joined: Wed Dec 04, 2013 3:34 pm
Location: Sweden Linkoping/Vadstena

Re: Setting up the board with pre-compiled binaries

Post by hasse.69 »

Yes i`ve tried but i can´t connect.
When i go to taskmanager it doesn´t show
amongst ports as in your picture it
shows up as STMicroelectronics STLink dongle
With the other USB.
"Electronically challenged of the world, unite!"
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

I guess what you are trying to say is that you have two USB cables - miniUSB and microUSB connected to stm and to your PC, but the new COM port does not appear?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
hasse.69
donator
donator
Posts: 77
Joined: Wed Dec 04, 2013 3:34 pm
Location: Sweden Linkoping/Vadstena

Re: Setting up the board with pre-compiled binaries

Post by hasse.69 »

No i just got the mini usb connected and have sucessfully managed to flash the board.
But now i cant get connected to the board when opening up Tunerstudio.
Do i have to have a microusb to "talk" to the board?
Problem solved: Mini USB is for power , MicroUSB is for "talking"
so easy , not :oops:
:lol:
Last edited by hasse.69 on Mon Jan 27, 2014 1:05 pm, edited 1 time in total.
"Electronically challenged of the world, unite!"
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: Setting up the board with pre-compiled binaries

Post by puff »

as far as i got, in the latest releases microusb port is for terminal usage, not for the tuner studio.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

We now have a build server which updates the binary archive automatically with each code change.

Can someone please figure out passing parameters to the Makefile?
Curretly we have

Code: Select all

static engine_type_e defaultEngineType = FORD_ASPIRE_1996;
default engine hard-coded into the firmware. While in the long run we would eliminate the whole concept of 'engine type', for now it would be easier if the build server could compile a couple of different firmware versions. So, instead of hard-coded defaultEngineType we would need to pass this a parameter to the 'make' command. Need help here.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

I'm having trouble getting the firmware to "boot". I flashed it ok, and disconnected in the ST link app. Then hit the black reset button and nothing changed. Tried several times, held it down for a second or two, tried over and over. Unplugged the USB cable, plugged back in. Ok, now the blue LED is blinking. Wasn't sure I saw the 4 LED's before that so I unplugged, plugged back in and nothing. Plug, replug, still nothing. Unplug, wait a few seconds, try again. Nothing. Play with the reset button some more. Still nothing. Back to stlink, reflash. Same deal, nothing. Erase chip, unplug. Replug, reflash. Same deal. Unplug USB, replug. Nothing, unplug, replug, finally a blinkin blue light again. Hit reset, it vanishes. There seems to be a problem with getting the firmware to fire off.
Worth noting, the USB console on the micro port does not show up when the blue light isn't blinking. Windows flat doesn't see the thing. I guess the port is emulated in the firmware? I downloaded it this evening, not sure what the compile date is, there's no documentation included with it.
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Setting up the board with pre-compiled binaries

Post by kb1gtt »

Have you followed this instruction? http://rusefi.com/wiki/index.php?title=Manual:Software:User/en#Load_firmware there could be a problem with that procedure our it might show some missed step. How did you obtain the firmware self compile ourprecompiled? I wonder if the firmware is corrupt.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

UnaClocker wrote:I'm having trouble getting the firmware to "boot".
That's pretty weird. It is definitely an stm32f4discovery on your desk is it?

I've just downloaded http://rusefi.com/build_server/rusefi_firmware.zip uncompressed it and flashed rusefi.hex into mine stm32f4discovery
Once I do 'program>browse>start' bla bla bla I did 'target->disconnect' just to be save and hit the black reset button (no need to hold it) - mine blinks the blue LED happily.

Another thing to try - try 'target>erase chip'? But that should not really be necessary...

Sometimes I have no unplug the USB to power the board off, but not now.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

yes stm32f4. Yes I downloaded the compiled version linked here. The other questions were covered in my previous comment.
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

UnaClocker wrote:Windows flat doesn't see the thing. I guess the port is emulated in the firmware?
Yes, that micro-USB port depends on the firmware. Can you try with micro USB cable removed? It looks like you've tried all the other combinations.
UnaClocker wrote: I downloaded it this evening, not sure what the compile date is, there's no documentation included with it.
You can see some dates if you open the whole folder http://rusefi.com/build_server/

Can someone else please try the programming the current firmware version?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

The date on the firmware is 0511 according to the what it's dumping to the console when I connect to it with a terminal.
Usually when I connect it to the computer, the blue LED never starts blinking, no amount of reset button presses help. Both red lights are on tho. This is with or without the console USB cable connected.
Sometimes the multicolor (the big LED) will blink on and off fairly slowly, like it's indicating some kind of error.
One out of about 20 tries, it'll power up correctly and the blue LED will start blinking.

This is running the bare STM32F4-Discovery board without the frankenstein shield.
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

I am only controlling the four LEDs between the buttons - blue, green, orange & red. The green/red and red close to mini USB socket and red close to micro USB are some general board/hw connection status LEDs.

So, which of the red LEDs do you see? because the red one close to the button would be an indication of something unexpected within the firmware - that's my ERROR status LED. Problem is that you only get a chance to read the exact error message from Eclipse with GDB, or on a HD44780 LCD screen, or on a TTL serial port (usb or real serial). It does not help that for some reason I cannot reproduce this with my board, even once I've disconnected everything :(
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

Did some more troubleshooting, it's the USB status LED that blinks sometimes. Usually when I plug/unplug the board rapidly trying to get it to boot up and the USB drivers fail to initialize because of the way I'm abusing them. ;) It does the same thing if I plug it into a USB phone charger, as there's no USB drivers on one of those. ;) I get the same success rate with the phone chargers, sometimes it'll boot and the blue light comes to life, usually it doesn't.
I got this STM32F4 board 3 years ago, when they were giving them away free. I played with it some back then, but not much. It's been in it's clamshell packaging ever since, dragged around with me to hackerspaces, MakerFaire (2 of them), and just generally handled a lot. Perhaps it got some static shock and killed a memory cell. I guess I'll go ahead and order another board, I'm not really out anything on this one, and I really plan to run this EFI, one way or another. ;)
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

Can you please try programming the .hex file from http://rusefi.com/data/STM32F4-Demo.zip?

That's original ST demo firmware, it would blink all four LEDs in a circle and it somehow reacts to board shaking. To some extent that should be a test of your board.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

Loaded the demo firmware on. Runs perfectly, reset button resets every time. Starts running correctly every time. Could still be a bad cell in the ram, the RTOS uses a lot more resources than a funny blinky program. ;) But it does confirm I can program the board correctly. :)
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

Damn, I was really hoping it would not blink :roll:
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

hehe, I'm not much for actual programming beyond something simple like an Arduino, but I do know my way around flashing microcontrollers and electronics in general. ;) I'm tempted to just order a new chip and replace the one on this board, but I guess I'd only be saving a couple bucks. ;)
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

Good news, I downloaded the 0515 version, (you really should include at least a file inside the zip with the build date as it's file name) and this one runs just fine. Flashed it onto the board, it fires up and runs every time. Yay. Interestingly, the green light flickers at the same rate as the blue, sometimes. Comes and go, almost seems to depend on how I'm holding the board?
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

I guess a timestamt.txt would be easy to implement.

As for the green light - it means 'cranking' or 'running'. I wonder if your finder on PC6 trigger the input trigger?... You better jump simulated signal to trigger input pins, see http://rusefi.com/forum/viewtopic.php?f=5&t=377&p=3913#p3913
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

Ok, jumped PD1 to PC6 and now the green comes on solid. I should probably setup TunerStudio and make some more meaningful contact, now that this thing boots every time. :)
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up the board with pre-compiled binaries

Post by AndreyB »

I've added svnrevision.h into the .zip file. It does not contain the date, only revision number - but that's much better than nothing :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: Setting up the board with pre-compiled binaries

Post by puff »

i used to check versions via file info - no need for special files....
i meant 'time created' field
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: Setting up the board with pre-compiled binaries

Post by UnaClocker »

What's this file info thing that shows version numbers? If it were me, the hex file would simply have the date appended to it. So rather than rusefi.zip, it'd be rusefi051514.zip or similar.
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
Post Reply