SM Re-Development in GCC + Customisations/fixes

Official FreeEMS vanilla firmware development, the heart and soul of the system!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

SM Re-Development in GCC + Customisations/fixes

Post by Fred »

EDIT: Comments here: viewtopic.php?f=8&t=1243

Tasks, to be performed in order, with revision control and verified by multiple developers, including me, but definitely at least one other, preferably more than one:
  • Rewrite the 2k binary SM for GCC, from scratch, until we have an identical binary to the TA provided one with fresh GPL code.
  • PORTA pullup off fix - may require TA mods , check this.... YES, see below.
  • Startup logic fix, don't check serial pin state!
  • Erase all fix, understand why it doesn't, then make it work.
Perhaps other simple things?

Rewrite to be more simple and use more robust serial comms?
Rewrite to use another comms method such as CAN?

TA users will need to:
  • Bridge 1k resistor to ground
  • Add 2k resistor to 5v
I consider that acceptable/easy. TA schematic is here:

Image

Sean has put up a repo of the original modified Freescale sources for code warrior, but:

A) I will not run windows and will not download codewarrior to build it
B) I don't want to distribute a not-completely-free SM with FreeEMS
C) The sources are pretty messy for many different S12 variants.
D) Making it available for GCC will make customising it for various purposes more straight forward
E) etc.

Hence GCC target and plan.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

I have analysed the situation at a meta level in detail and have a 12 step plan to implement before the above changes are applied.

The first step is underway, however if that fails it doesn't matter much.

The next six steps should take less than a day.

The following five steps should take less than a day too.

The above changes range from stupidly simple to slightly tricky but should also not take more than a day.

Total estimated work: 3 days. (assuming working ONLY on this, which is unlikely)

Only the last two steps and our changes require a BDM to do, so I can carry on with this and get most of it done while I wait for it to arrive.

I'll be less vague about the steps involved once I've completed them and published the work.

I've split this thread into a comments thread now too.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

The original step one is complete. Things were not as I thought, so there is a new step one which is now underway instead :-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

I finally did some experimentation today. This is what I found:

Saleae Logic analyser attached to reset pin and a PORTA pin and with the last commit we see 1.29ms of port high with a 4us delay post the reset rising edge before it comes up. I adjusted the code to run DDRA = ONES; first before init and the result is 1.113ms proving that it's simply a port config thing left over from the SM running (register state doesn't get reset!). Then I replaced that with PUCR = ZEROS; and got the same result.

So, this PROVES that the SM pull up is the issue just as Chris discovered/realised/found out for us.

Back to the code now!

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

The standard code also checks the vector space before checking the pin states. I propose that for our version we remove that so as to come out of reset to either firmware or SM a few clock cycles sooner and keep the asm simpler too.

It might be worthwhile ripping out all of the debug style stuff too as I don't think any of it works the way we use it anyway.

I wonder if there would be enough room for a better protocol in tandem with the standard one if all that was done? An extra command byte could be added to switch into that mode. Then you could open comms, switch mode, check connection, and proceed to perform all operations with checksums and/or packet delimiters.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

Yesterday's development of loading code using a BDM on Linux opens the door to resume work on this in the near future. I'll have to dredge up my notes and sources and spend a sunny Sunday afternoon hacking away on it. With RavAGE drawing ever-nearer to production this will become important soon, especially to simplify choices of isolation devices.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

Received a package from China today and found some sweet tweezers inside. And a K type tcouple, so decided to work on the oven

viewtopic.php?f=37&t=1592&p=24905#p24905

Also wrote some sweet docs for keeping people on the straight and narrow version wise:

viewtopic.php?f=54&t=1639

Will try to achieve a bit more before bed, but still need dinner and wife duties, and it's 10pm already, so might be squeezing it in tightly.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

In a week or two I'll receive an autographed serial-numbered Jaguar A3 board for my collection of prototype FreeEMS hardware. Once that arrives I'm going to assemble it and then use it to test new SM variants. That will eliminate hardware hacking by way of PNP mod for anyone designing new boards. Specifically it will allow Andy to un-mod his boards and proceed with a more sane setup. Once it arrives that will be my highest priority. In the mean time I have some other things going on that need to be handled, including ignition control for DIS setups, which actually should be easy. I'll likely get that done with Andy on the phone tomorrow so he can really get stuck into tuning his Deuce Coupe :-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

It's here! I'm still waiting on parts from China/HK to arrive, but I could/can hand solder it in the mean time, or just guess the temperature profile. I also need to pick up a BOM for it. I got most of the caps already, but have to get more stuff for it.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: SM Re-Development in GCC + Customisations/fixes

Post by Fred »

And for the first time, it talks reliably! Now I either need this to happen, or to hack in a PNP, so I'd better get this done! I need the board working for a secret project.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Locked