AVR to Arduino - VPW

Ecu Hardware Modifications
User avatar
Tazzi
Posts: 3425
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: AVR to Arduino - VPW

Post by Tazzi »

Ahhh, 7volts rings a bell. Cheers!
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: AVR to Arduino - VPW

Post by antus »

Technically for vpw your meant to smooth the wave out also - its in the elm schematic where they switch also a 5v line to provide a step but all the elm clones omit that part and seem to get away with running a square wave. Not idel for signal quality of the bus though.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
Tazzi
Posts: 3425
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: AVR to Arduino - VPW

Post by Tazzi »

antus wrote:Technically for vpw your meant to smooth the wave out also - its in the elm schematic where they switch also a 5v line to provide a step but all the elm clones omit that part and seem to get away with running a square wave. Not idel for signal quality of the bus though.
Haha.. of course they would skip out on things related to "quality".
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
VL400
Posts: 4991
Joined: Sun Mar 01, 2009 2:54 pm
cars: VL Calais and Toyota Landcruiser. Plus some toys :)
Location: Perth, WA
Contact:

Re: AVR to Arduino - VPW

Post by VL400 »

That's for edge rate control to help with emc compliance. It reduces the high frequency components. Its of course not high on the clones list of requirements.
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: AVR to Arduino - VPW

Post by antus »

Heres 2 documents that might help. Firstly the elm schematic, if you wanted to implement the shaped corners you could build all the hardware on pin 3,4,11,13.

Or if you wanted off the shelf hardware that fits that schematic, but omits pins 3 and 13, heres a reference. You'd need a pickit 2 or 3 and the pic tools to build firmware though.
Attachments
Schema_interface_ELM327.JPG
Schema_interface_ELM327.JPG (85.92 KiB) Viewed 6809 times
circuit reference.png
circuit reference.png (3.59 MiB) Viewed 6809 times
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
VL400
Posts: 4991
Joined: Sun Mar 01, 2009 2:54 pm
cars: VL Calais and Toyota Landcruiser. Plus some toys :)
Location: Perth, WA
Contact:

Re: AVR to Arduino - VPW

Post by VL400 »

Oh that circuit is for selecting j1850 pwm or j1860 vpw, nothing to do with edge control. Pwm is 5v while vpw is 7v.
User avatar
Tazzi
Posts: 3425
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: AVR to Arduino - VPW

Post by Tazzi »

antus wrote:Heres 2 documents that might help. Firstly the elm schematic, if you wanted to implement the shaped corners you could build all the hardware on pin 3,4,11,13.

Or if you wanted off the shelf hardware that fits that schematic, but omits pins 3 and 13, heres a reference. You'd need a pickit 2 or 3 and the pic tools to build firmware though.
The ELM devices are looking better and better. So a PICkit 2 Microcontroller Programmer would do the job I guess. And can use the MPLAB X IDE that comes with it I guess.
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: AVR to Arduino - VPW

Post by antus »

VL400 wrote:Oh that circuit is for selecting j1850 pwm or j1860 vpw, nothing to do with edge control. Pwm is 5v while vpw is 7v.
ahh ok.
Tazzi wrote:The ELM devices are looking better and better. So a PICkit 2 Microcontroller Programmer would do the job I guess. And can use the MPLAB X IDE that comes with it I guess.
yep thats right. Different pins and clock speed to the original code, but might not be so hard to adapt to this hardware. Not all elm clones are the same, but I think they mostly would have the programming port and the rest of it you know will be compatible even if it has a different pcb layout and usb front end chip. You should check to see whats inside one of yours, if you have the programming header and a square pad down one end you should be able to just hook up and use it.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
Tazzi
Posts: 3425
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: AVR to Arduino - VPW

Post by Tazzi »

Im a bit lost on how to edit the prescaler in the coding.. and even then, will have to modify the timing values for each parameter (eg SOF). Sooo.. might just attempt swapping out the 16mhz crystal for the 4mhz one.
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
antus
Site Admin
Posts: 8250
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: AVR to Arduino - VPW

Post by antus »

Just reading back over your code
Tazzi wrote: // convert microseconds to counter values - Prescaler calculation here
#define us2cnt(us) ((unsigned int)((unsigned long)(us) / (1000000L / (float)((unsigned long)MCU_XTAL / 1L)))) //So, converting microseconds.. into.. ??
// So it is: (int)(long)microsecond/ (1000000L/ (float)(long 4000000 / 1L)) - Im not sure what the L stands for? hmm...
the timer is counting ticks, which are related to cpu speed. so this is defining a macro us2cnt(us) or microsecongs to count (number of microseconds). So...
Tazzi wrote:#define WAIT_100us us2cnt(100) // 100us, used to count 100ms - so all that us2count is converting 100microseconds to 100milli seconds? Is that right?
its converting a measure of 100 microseconds to number of counts at the current clock speed to load the timer with.

When MCU_XTAL becomes faster the resulting number of counts will also enlarge automatically, but at some point the number of counts overflows the size of the counter. You can either calculate it and see if the number will fit or make a test app that just flips a pin every 100us using this function and then watch on a scope to test for accuracy.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
Post Reply