Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Engine Data Logging - STM32 Primer 2


Guru

Status: Offline
Posts: 1233
Date:
Engine Data Logging - STM32 Primer 2


I built a new serial interface for the Primer 2 and tried a version of Boerd's code for engine data logging that he sent to me recently. It worked, i was able to connect to my bench testing ecu and display data on the screen of the Primer 2!!!

Very excited by this progress!

For those who have not seen Boerd's interface schematic see below

Its pretty easy to build, i used an extension board for the primer 2 which plugs into a 20 pin plug on the primer 2 and provides access to the serial data pins.

You can buy the extension boards here http://www.watterott.com/en/STM32-Primer2-Add-On-Module

Q1 and Q2 in the schematic are standard transistors BC547 (thanks Greg for sending me a bunch of these and resistors and plugs etc)

So from my basic but expanding understanding of electronics a basic explanation for this circuits function follows (and please correct me if i get something wrong)
  • The K line into the ecu is a single wire which both receives and transmits data for engine communications, this is called half duplex operation. In half duplex only one end can send data at a time.
  • The Primer 2 has both a tx (transmit) and rx (receive) pins which allows full duplex serial communications and it is able to send and receive data at the same time.
  • The circuit below combines the tx (transmit) and rx (receive) from the primer 2 into the single k line into and out of the ecu.
  • For serial communications to work correctly between 2 devices the voltage levels must be that same.
  • the circuit amplifies the 2.9 v serial tx (Transmit) line signal from the primer 2 to the higher voltage required for the serial K line into the m32r ecu. This is done by the top part off the circuit which uses transistors and resistors to step up the voltage.
  • 2 transistors are used, the first one amplifies but inverts the signal and the second one inverts the signal again which brings it back into phase.
  • The higher voltage to step up the signal voltage is supplied from pin 17 taken from the ecu.
  • the circuit steps down the voltage from the K line transmitted from the m32r to the 2.9 v required for the Primer 2 rx (receive) pin, this is done by the resistors R6 and R3 in the bottom of the diagram below.
I hope the above makes sense and helps explain how this works, I find it easier to get things to work if i understand the maths and theory behind them :)

primer2x.jpg



-- Edited by jkwool on Thursday 30th of September 2010 11:19:45 AM

__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Guru

Status: Offline
Posts: 953
Date:

shoot just realized i dont have a sd card yet for my primer2

awesome news though!

__________________


Veteran Member

Status: Offline
Posts: 98
Date:

Hi Justin,

please dont share the code!!!

I do not know now what happens when someone connects the primer to the ECU and the menu item Connect to host performs.

If anyone wants the code please notify the person who then gets a modified version
.

Boerd

__________________


Guru

Status: Offline
Posts: 953
Date:

boerd, could i get the software? I have a primer 2, just need to make up a circuit.

Thanks,

Greg
greg@boostbysmith.com

__________________


Veteran Member

Status: Offline
Posts: 98
Date:

Hi Greg,

have funwink

__________________


Guru

Status: Offline
Posts: 953
Date:

excellent, thank you :)

__________________


Guru

Status: Offline
Posts: 1344
Date:

greg,any plans to build plug-n-play intrefaces...?..i am ready to try the primer

__________________

09 busa.????? now what....still got what it takes.......!

I got what you need...!
www.poweredbyford.com

www.marc@poweredbyford.com

 



Guru

Status: Offline
Posts: 1233
Date:

Boerd wrote:

Hi Justin,

please dont share the code!!!

I do not know now what happens when someone connects the primer to the ECU and the menu item Connect to host performs.

If anyone wants the code please notify the person who then gets a modified version
.

Boerd



No problems Boerd.

 



__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Guru

Status: Offline
Posts: 953
Date:

no idea what the real creators have planned, if that becomes an option that Boerd agrees on etc i most certainly will, but i am excited about this whether its just testing it, using it for personal stuff, or selling as a product, or all of the above :)

__________________


Guru

Status: Offline
Posts: 1344
Date:

no problem, i am just sick of lugging the laptop around, and i would love to test this also....

__________________

09 busa.????? now what....still got what it takes.......!

I got what you need...!
www.poweredbyford.com

www.marc@poweredbyford.com

 



Guru

Status: Offline
Posts: 1344
Date:

boerd, can i also test the code too...? you have my e-mail adress already....thanks



__________________

09 busa.????? now what....still got what it takes.......!

I got what you need...!
www.poweredbyford.com

www.marc@poweredbyford.com

 



Veteran Member

Status: Offline
Posts: 98
Date:

How to do flash the Primer2:

Install the Ride7 software  that comes with your Primer2 or load the last version from http://www.raisonance.com/mcu_downloads.html.

If you dont want the Ride7 on your Hard-Disk you must install the RLinkDrv.

The software you get of mine had three files: program-flash-......bat-file, Cortex_pgm.exe and a ......hex file.
The .....hex file is the code for the Primer2,
the Cortex_flash.exe is for flashing the Primer2 this Prg. need the RLinkDrv,
and the program-flash-.......bat call only the Cortex_pgm.exe with the right instructions.

Connect the PC and the Primer2 with the usb-cable, Primer2 site mini-usb DEBUG and push the joystick, double click on the program-flash-....bat and after a few seconds, the Primer2 programmed.

Very Important:
Please watch three times, better four times  if you have the correct resistance(R6&R3) and the correct position in the interface, otherwise the Primer2 destroyed.


If the Primer2 powered by the battery voltage: Please charge the battery completely before you the Primer2 used, then please do not turn on more than one hour. It arrived before the battery voltage falls below 2.77V sings to damage the battery.


For the moment i have remove the sd-card and usb function, why a small example, the boost pressure or the diff-IAP on the screen display is very simple but the program change it works with fast-logging is a lot of work. So I have to wait for what we want.

Boerd


-- Edited by Boerd on Friday 1st of October 2010 05:54:07 AM

__________________


Veteran Member

Status: Offline
Posts: 92
Date:

hey how can i get a copy of the code i have gotten my primer2 and i ordered the add on board

__________________


Veteran Member

Status: Offline
Posts: 92
Date:

THanks

__________________


Veteran Member

Status: Offline
Posts: 98
Date:

slantman wrote:

THanks




Sorry slantman worship.gif

let me know where do i send the code handshake.gif

 

Boerd



__________________


Veteran Member

Status: Offline
Posts: 92
Date:

hey thank you
slantman@bellsouth.net


__________________


Veteran Member

Status: Offline
Posts: 92
Date:

Hey Boerd
Did you send that file?

__________________


Veteran Member

Status: Offline
Posts: 98
Date:

Hi slantman,
Yes, in this moment.

__________________


Veteran Member

Status: Offline
Posts: 98
Date:

Hi,
on the picture you can see the interface below on the ADD-ON-Module.
The 5VFTDI goes to the 2.8V Primer2 power supply, and the R4 is not needed

For fast logging R9 = 1K !!!!









Boerd

-- Edited by Boerd on Monday 11th of October 2010 03:56:08 PM

-- Edited by Boerd on Wednesday 13th of October 2010 06:45:28 PM

__________________


Veteran Member

Status: Offline
Posts: 92
Date:

hey Boerd I still have not received that file yet.

__________________


Veteran Member

Status: Offline
Posts: 98
Date:

hmmok i send it yet again confuse

__________________


Veteran Member

Status: Offline
Posts: 92
Date:

thanks i got it, it was marked as spam on my mail server

__________________


Veteran Member

Status: Offline
Posts: 98
Date:

Hi,

i speak a bit with myselfhmm

why the new interface, first, it is safer for the following hardware (FTDI or Primer1 / 2).

but mostly now logging works fine when the headlights are not turned on.
have tested it to 11000rpm. so i will test it also with fast logging.

greetings

Boerd

__________________


Guru

Status: Offline
Posts: 1233
Date:

Boerd wrote:

Hi,

i speak a bit with myselfhmm

why the new interface, first, it is safer for the following hardware (FTDI or Primer1 / 2).

but mostly now logging works fine when the headlights are not turned on.
have tested it to 11000rpm. so i will test it also with fast logging.

greetings

Boerd




Thats great news Boerd!



__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Veteran Member

Status: Offline
Posts: 98
Date:

Hi,

here are pictures of a board, all parts in SMD. Dimensions 23,495 x 19,05mm

Top:




Bottom:




Boerd

__________________


Guru

Status: Offline
Posts: 1233
Date:

I built an interface using Boerd's new design tonight and i was able to connect to my bench ECU and data was being read from the ECU to the primer 2!

Well done Boerd, I am now very interested to see if it works for 50000 fast baud rate!

Cheers
-Justin.


__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Veteran Member

Status: Offline
Posts: 98
Date:

Boerd wrote:

but mostly now logging works fine when the headlights are not turned on.
have tested it to 11000rpm. so i will test it also with fast logging.



Hi,

the same result with 50000 baud, time between the KWP packages 65ms.

But see the circuit above for fast logging R9 must 1K.

Boerd

 



__________________


Veteran Member

Status: Offline
Posts: 92
Date:

now the big question is someone going to make up these board and sell them?

__________________


Veteran Member

Status: Offline
Posts: 98
Date:

Hi,

today i make a test to find out the min. time between the KWP requests:

the min. time for fast logging without any error is 50.41ms.

Boerd

__________________


Guru

Status: Offline
Posts: 1233
Date:

Awesome!!! 50ms was the target for fast baud data logging! great news Boerd.

Boerd and I have been discussing some options for integrating the Primer 2 data logging with ECU Editor and Auto Tune. The current thinking is that the primer 2 will be plugged into the ecu via the new serial interface design (see above) and data will be logged directly to the SD Card in the Primer 2.

When the data logging session is finished you will be able to disconnect the Primer 2 from the ecu and plug it into your laptop via the usb host port on the primer 2. I will write some code in ECU Editor to connect to the data stored on the Primer 2 SD Card and load it directly into the Auto Tune functionality in ECU Editor.

The data could be reviewed in ECU Editor and changes applied to the bin file. The laptop running ecu editor can them be used to flash the changes back to the ecu for the next iteration of logging and tuning.

__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Veteran Member

Status: Offline
Posts: 49
Date:

justin, boerd great work this is going to make things so much easier cause the officials at the track hate my laptop in my backpack

__________________


Veteran Member

Status: Offline
Posts: 92
Date:

how are you guys tapping into pin 32 (serial data)?

__________________


Guru

Status: Offline
Posts: 1233
Date:

slantman wrote:

how are you guys tapping into pin 32 (serial data)?




I bought some plugs the same as used for Greg's harness so the primer will plug straight into the harness. The plugs are Molex Mini Fit Jr



__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Veteran Member

Status: Offline
Posts: 92
Date:

jkwool wrote:

 

slantman wrote:

how are you guys tapping into pin 32 (serial data)?




I bought some plugs the same as used for Greg's harness so the primer will plug straight into the harness. The plugs are Molex Mini Fit Jr

 



so your plugging into the SDS connector.

 



__________________


Guru

Status: Offline
Posts: 1233
Date:

slantman wrote:
so your plugging into the SDS connector.

 



No i leave Greg's harness mounted on my bike, the Molex Mini Fit Jr plug is the 8 pin (2 rows of 4 pins) that plugs directly into the Flashing box (with the switch on it) in Greg's set up. for the primer i only use 3 of the pins the +ve 12v Power, the -ve Ground and the K Line.



__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Member

Status: Offline
Posts: 19
Date:

So how close are we to getting Greg involved to sell this as a pnp kit? I too, am tired of lugging my netbook in my backpack. Think of all the additional runs one could have it it was as simple as plugging in the primer 2!!

__________________

2K9 Black 'Busa - DOA

K11 Black 'Busa RCC Stage 1 - 303 HP

2009 1989 ZX9R - labor of love



Guru

Status: Offline
Posts: 953
Date:

whether i will be doing that is still to be determined, i would like to have direct permission from Boerd and Justin as I haven't personally invested my time like these guys have etc. I have been really swamped with my day job and not contributed anywhere near like i would like to here lately. Anyhow like to see this take off and start working well, then if these guys would like me to offer something for others to purchase, or if they want to do something themelves to make some money totally cool too, i am excited about this stuff, wish i had a little more free time at this point lol

__________________


Member

Status: Offline
Posts: 19
Date:

That was fast, Greg. wink.gif

Justin and Boerd, what are your thoughts? Are you interested in the packaging side, or can we hand it off to Greg to help move the entire project forward?

__________________

2K9 Black 'Busa - DOA

K11 Black 'Busa RCC Stage 1 - 303 HP

2009 1989 ZX9R - labor of love



Guru

Status: Offline
Posts: 1344
Date:

as much as i would love to see greg make a plug-n-play interface, the software and hardware still needs to be tested and be stable...., before a person can invest, and gamble that people will buy, this is a big decision....justin........and.....boerd has invested lots of time, as a team to make this possible, so far so good...thanks guy's.....i really do apperciate it....personally.....marc.....smile

__________________

09 busa.????? now what....still got what it takes.......!

I got what you need...!
www.poweredbyford.com

www.marc@poweredbyford.com

 



Guru

Status: Offline
Posts: 1233
Date:

Craash wrote:

That was fast, Greg. wink.gif

Justin and Boerd, what are your thoughts? Are you interested in the packaging side, or can we hand it off to Greg to help move the entire project forward?



I can not speak for Boerd (who I give credit to for most of the Primer 2 side of things), but from my perspective i have no problem at all with Greg putting the hardware together and selling it to allow guys to start using the primer 2 to data log. Greg has been a huge help to me from the start with both advice and supplying all sorts of hardware and electrical components free of charge for me to use, (especially considering i live down under on the other side of the world :)

Thats the cool thing about this project, for me its about having fun, helping each other out and getting our bikes running the best we can!


__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Guru

Status: Offline
Posts: 1233
Date:

I built the new interface design on the internal section of the primer 2 extension connector last night. I thought i would share the mud map grid layout i used to place the components to fit on the Primer 2 extension inside the case. I tested the interface on my bike with the engine running today with the headlight off and it worked!

The image below may help someone trying to do the same. The intersections of the grid represent the pin locations on the Primer 2 extension boards.

I used Standard cat 5 network cable to run from the extension connector to the ecu and connect to the flash harness using a Molex Mini Fit Jnr plug.

Primer 2 Internal Extension Interface


__________________

site_logo_small.png

www.WoolichRacing.comTune your bike to the Limit with our Advanced ECU Flashing Products



Member

Status: Offline
Posts: 8
Date:



-- Edited by barny08 on Monday 8th of November 2010 09:12:45 AM

__________________


Veteran Member

Status: Offline
Posts: 92
Date:

so greg have you given any thought about building those add on boards?

__________________


Veteran Member

Status: Offline
Posts: 95
Date:

slantman wrote:

so greg have you given any thought about building those add on boards?




Does anybody build them for $?  I know I would gladly pay for one and I'm sure others would also

 



__________________


Guru

Status: Offline
Posts: 953
Date:

Boerd is working on his logging setup, but nothing is ready for sale etc.

__________________


Senior Member

Status: Offline
Posts: 498
Date:

Justin & Beord.......WOW!!! You Guys Rock!! smile Man I Can't Believe How Far things have come in so Little Time.....Guess that's what Happens when you Have this Many TRULEY GREAT MINDS At Work. wink 
Thank You "ALL" (Petrik, Jasa, Justin, Beord, Greg, and I KNOW THERES MANY MORE I am Forgetting, Please Forgive Me) For ALL the Great, Hard, Excellent Work you all Have Put in for us Hayabusa/B-King Owner's!!! smile 

__________________
08 Busa AKA: }ToXSicK{


Senior Member

Status: Offline
Posts: 196
Date:

 

  Boerd,

 

 I have the primer2 and was wondering if you would still want to share/sell the code to run the logger program with it. I have did a little bit of studying the unit and know that I would have to use the asart pins but, I don't know much about setting up interupts or data requests.

I am aware that you are building a logg-box and I would understand if you need to keep the code private.

 

Thank you,

Mark   buddrinker59@yahoo.com



-- Edited by Busa Quick on Sunday 17th of April 2011 03:46:07 PM

__________________


Veteran Member

Status: Offline
Posts: 36
Date:

Hi,

does logging work with the Evoprimer STM32 too? Primer2 won´t be produced anymore...

With kind regards, Torsten.

__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard