Fred's firmware development diary

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

Re: Fred's firmware development diary

Post by Fred »

Autonomous logging data through serial comms :

Code: Select all

@[FreeEMS Logging Data]Seconds = 00000, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00001, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00002, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00003, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00004, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00005, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00006, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00007, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00008, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00009, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00010, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00011, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00012, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00013, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
@[FreeEMS Logging Data]Seconds = 00014, LowVolts = 000, LostCamSync = 000, LostCrankSync = 000[End]X
I'll do some more work and confirm that some things work as I thought they did and post a dirty hacky release later today. I may even get a chance to consult a C guru before that and make it unhacky. There is currently significant duplication of code which is very ugly.

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: Fred's firmware development diary

Post by Fred »

Image

There was a bug in the handling of char to ascii so now lostcranksync can be displayed it works :-)

Also visible is rpm increasing and decreasing and pulsewidth decreasing and increasing and 1/3 down a processor reset (induced by me). All things that have been happening for ages, it's just that now I can view the exact numbers involved, the RPM jitter etc etc.

Mint!

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: Fred's firmware development diary

Post by Fred »

Well, it's been a while, but I needed to get something out with some progress in it, and this is visible and useful progress, so :

Image

FreeEMS0-v0.0.13 (googoogaga) is released!

0.0.13 (googoogaga) 12/6/08
Added more comments
Added basic logging of interesting vars using serial
Added serial send unsigned char,short,long
Added itoa() functions for char,short,long
Added serial send string
Added header section for SCI0
Started adding serial setup stuff
Fixed baud config const
Added comments about structure to scheduler
Fixed issue with loops in ign sched
Remove unused bit bang demo function
Add trial send call to main loop
Added duplicate SCI0 section to header with base to use later
Added interface, version, and user strings and definitions

http://sourceforge.net/project/showfile ... _id=606321

Enjoy,

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: Fred's firmware development diary

Post by Fred »

I added the generated files from FreeTherm 0.3 to the FreeEMS source and wrote some simple code to make use of them and ran it :

Image

Go FreeTherm!! :

Image

I'll probably try to tidy a few things up and cross a few things off the list of TODOs and put out another release tomorrow for that stuff.

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: Fred's firmware development diary

Post by Fred »

We now have the 6 main input variables in their actual form, rather than raw ADC counts :-)

I just did a short log proving my TPS boxing code. woo hoo....

Image

I still need to redo the ADC sampling and use code and introduce new variables for various things/rearrange etc, so a release today isn't looking likely, but probably before Monday UK time I would imagine.

I can almost hear the injectors ticking LOL (year right).

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: Fred's firmware development diary

Post by Fred »

OK, MAJOR firmware progress has been happening this weekend. MANY things have changed in the code. I'll be posting a new release sometime tomorrow after I finish tidying up the headers a bit. The code is all ready for some serious math and flash writing and serial code to be added. All the variables are being obtained accurately and quickly and in a nice way. It is now possible to assign an ADC input to a particular variable via the tuning interface (once we have it) so ADC's are generic which is nice for board designers. I've laid them out in a nice order though such that the default makes good sense. It might be nice to leave the first bank permanently assigned to the main functions and just allow adjustablility on the extra 8 to keep things simple. No decision required at this stage though.

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: Fred's firmware development diary

Post by Fred »

Well, a LOT of work has gone into this one and here it is :

freeems-v0.0.14-entropy :-)

0.0.14 (entropy) 24/6/08
Added FreeTherm generated transfer table for IAT
Added FreeTherm generated transfer table for CHT
Added code to obtain MAP from a min range pair
Added code to obtain EGO from a min range pair
Added code to obtain TPS from an ADC min/max/range and max set of data
Changed logging code to be more readable and compact
Changed SCI block to use a base address
Added configuration and header for the second block of ADC inputs
Added code to sample the second block
Changed ADC blocks to use base address
Added AAP variable and calculation
Added BRV variable and calculation
Changed 3 ints to 3 unsigned chars in utils.c
Factored out ADC sampling to two methods in different ways
Fixed poor header structure (again) (might have it right this time)
Removed unrequired void from init() definition.
Added ADC reading counters
Renamed ADC reading timeout counter
CamelCased all files except linker scripts
Factored out hr serial logging
Moved pwm demo to utils.c
Measured time of ADC reading functions at less than 1us each, and removed non loop implementation
Used #define to ensure extern keyword applied appropriately
Fixed makefile dependencies to only recompile sources that are changed
Fix makefile paths for execution from explicit to user based
Changed makefile to chain execution such that each stage is done only once
Added output dir to keep clutter down
Added backup of .s19 to makefile
Added extern #define structure to all headers
Split oversized freeems.h down to managable chunks
Moved s19 storage to own directory
Introduced dependency on all headers for all source files (previously rebuilding ALL files EVERY time)

Biggest change log by a factor of 3!!

https://sourceforge.net/project/showfil ... _id=608887

Enjoy :-)

Don't forget to find me a name for the next one, see the thread in the lounge!

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: Fred's firmware development diary

Post by Fred »

I've been working really hard/flat out on the code since the last release and have an announcement to make!

We have just overflowed the "text" region :-) that means greater than 16kB of data is in the image now. The introduction of the VE and advance tables did this.

Code: Select all

/usr/lib/gcc-lib/m68hc11/3.3.6-m68hc1x-20060122/../../../../m68hc11/bin/ld: region text is full (zOutput/freeems-v0.0.15.elf section .rodata)
/usr/lib/gcc-lib/m68hc11/3.3.6-m68hc1x-20060122/../../../../m68hc11/bin/ld: section .vectors [0000f710 -> 0000f7ff] overlaps section .rodata [0000dfa0 -> 000100c7]
/usr/lib/gcc-lib/m68hc11/3.3.6-m68hc1x-20060122/../../../../m68hc11/bin/ld: zOutput/freeems-v0.0.15.elf: section .vectors lma 0xf710 overlaps previous sections
collect2: ld returned 1 exit status
I've heavily restructured much of the code over the last 2 days aswell. You know what they say "refactor mercilessly", of course, some people have a hard time refactoring their own code :-) I'm not one of them.

Now to put memory management to the test. I'll have to allocate some parts to different flash blocks. Let's hope it works :-)

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: Fred's firmware development diary

Post by Fred »

Code: Select all

FLASH write: address range <0x4004-0x47FF> size <0x07FC>
FLASH write: address range <0x4804-0x4FFF> size <0x07FC>
FLASH write: address range <0xC000-0xF0C7> size <0x30C8>
FLASH write: address range <0xF710-0xF7FF> size <0x00F0>
FLASH write: image [##################################################]
FLASH write: image size <16816 B> time <4.24 s> rate <3966 B/s>

Code: Select all

FLASH write: address range <0x4004-0x47FF> size <0x07FC>
FLASH write: address range <0x4804-0x5C3B> size <0x1438>
FLASH write: address range <0xC000-0xE48B> size <0x248C>
FLASH write: address range <0xF710-0xF7FF> size <0x00F0>
FLASH write: image [##################################################]
FLASH write: image size <16816 B> time <4.30 s> rate <3910 B/s>
Yup, it works, just temporarily I've moved all const structs to a separate page of flash. I will probably break it down a bit further such that I can guarantee the location of each one when copying it up to ram. I guess firstly I should ensure it all still works correctly, then I should try relocating the flash to ram such that it can be changed on the fly again. Then I should break it down into manageable chunks with the memory allocation linker files and scripts.

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: Fred's firmware development diary

Post by Fred »

Well, moving it worked, but the code didn't afterwards! It had me on a wild goose chase for a while, but eventually I realised that the "constants" were all returning 0xFFFF instead of their value. Obviously that caused issues with pretty much everything. Caused various things to corrupt all the memory etc etc etc. In the end I've tracked it down to which page of memory it is stored in. Although extracting the data from the cpu again shows it is correct in flash and the addresses of wrong variables are correct the values are still wrong. Unless hcs12mem is lying to me about where it is putting and getting things from, I'm not sure what is going on. The linker scripts and makefile may be able to solve this. We will see.

Don't expect another glorious release for a little while till I have that nailed down and described in this thread in detail.

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!
Locked