Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: m32R Serial Interface - Trying to Speed up Engine Datalogging


Guru

Status: Offline
Posts: 1233
Date:
m32R Serial Interface - Trying to Speed up Engine Datalogging


Hi, I thought I would start a new thread to both document my steps as well as to possibly get some help and suggestions on this issue. Feel free to add some info if you have any ideas that i could try.

So what i am trying to do is to speed up the rate at which we can log Engine Data from the ecu via the serial interface.

My goal is to be able to consistently log engine data at around 20 hz (i.e. every 50ms). This should allow us to log a good amount of data for the auto tune process as well as allowing drag racing guys to log runs and get a meaningful amount of data from a pass.

I will add separate posts for the different things i have tried so far.


__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1344
Date:

are you logging in uart mode..?

__________________

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:

what sio are you using...?

__________________

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:

i would assume scio, since you are logging 8bit fuel...?

__________________

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:

Baud rate CSIO mode : 152 bits/sec to 5 Mbits/sec (when f(BCLK) = 40 MHz/internal clock selected)

(Note 1) Max 2.5 Mbits/sec (when f(BCLK) = 40 MHz/external clock selected)

UART mode : 19 bits/sec to 2.5 Mbits/sec (when f(BCLK) = 40 MHz)



__________________

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:

Increasing the Baud Rate

The standard serial Baud rate for the Serial Interface SIO4 used for the engine data communications is 10,400. This is controlled predominately by the SIO4 Baud Rate Register located at 0x00800A17. There are other registers that affect the Baud Rate but I have chosen to concentrate on this register. see the hardware manual for details on the other registers.

The default value of the SIO4 Baud Rate Register is 0x17 (23) which gives a Baud Rate of 10,400.

With the baud rate set at 10,400 the fastest you can reliably retrieve engine data is around every 150ms.

I have changed this setting by modifying initialization routine at &H13259 and setting the value to 0x4 which gives a Baud Rate of 50,000.

With the baud rate set at 50,000 the fastest you can reliably retrieve engine data is around every 100ms.

Everything else being equal, I would expect to see this rate speed up by around 5 times (i.e. to around 30ms) but unfortunately this is not the case.

Based on the above something else seems to be restricting the rate at which we can request the data over the serial interface... I have tried other baud rates including 125000, 250000 etc but i was unable to make a stable connection to the ecu at these rates.





__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1344
Date:

i see jk, i will look and see if i can help...biggrin



__________________

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:

the fixed period clock, when using sio4 clock, the function id divided by 2..?

__________________

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:

Increasing the SIO4 Interrupt Priority

The process for requesting engine data from the ecu involves the requesting application initiating communications and then sending a request for particular data by sending a series of bytes which specify which set of engine data to send back.

This code runs on the ecu as an Interrupt. When the external application sends a request an interrupt is fired on the ecu.

The interrupt routine is specified in the interrupt vector table at 0x000000FC

The interrupt routine processes the request to determine which group of data (kwp packet) to send back.

The way interrupts work is when an external event happens (i.e. client application send request over serial line) the relevant interrupt fires and the code from the interrupt vector table runs. When (i.e. how soon) this happens is controlled by the interrupt priority. On the m32R there are 8 different priorities with lower numbers being higher priority. The highest priority interrupts run first followed by the next highest priority interrupt etc etc.

By default the SIO4 receive interrupt is set to priority 6, so I have tried setting it to a lower priority by changing the initialization code at 0x000127E8 to set the priority to 3.

This had no effect on speeding up the engine data serial communications... So i conclude from this that the serial communication speed is not being limited by the Interrupt Priority of the SIO4 request Interrupt handler.


__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1344
Date:

let me make some notes , and talk to my-self to see if i can help...good work jk...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:

stocker wrote:

the fixed period clock, when using sio4 clock, the function id divided by 2..?



full details are in the hardware manual around p564-580

basically the baud rate calculation is

standard baud rate i.e. 10,400

Hex Value = 17
Convert To Decimal => 23
Add 1 => 24
Multiply by 16 => 384
divide by 4000000 => 0.000096
Invert i.e. 1/value => 10,416.67

fast baud rate i.e 50000
Hex Value = 4
Convert To Decimal => 4
Add 1 =>5
Multiply by 16 => 80
divide by 4000000 => 0.00002
Invert i.e. 1/value => 50,000.00



-- Edited by jkwool on Sunday 5th of September 2010 02:48:15 AM

__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1233
Date:

Use a Smaller Size Data Package
The next thing i have tried is to use a smaller data package. Currently the main data is requested from the engine with the following sequence of bytes

0x80 0x12 0xF1 0x2 0x21 0x8 0xAE

This returns 128 bytes of data which has a theoretical transfer time of around 125 ms at 10400 baud.

the calculation for this is

128 bytes in kwp package
8 bit per byte plus start and stop bits => 1280 bits
10400 baud = 10400 bits per sec => 8.125 packages per second
theoretical transfer time= approx every 125 ms

so i figure if i use one of the smaller kwp packages with less bytes of data to transfer it should be faster.

So i tried to use the kwp package requested with the following byte sequence

0x80 0x12 0xF1 0x2 0x21 0x40 0xFF

this kwp package is around 28 bytes long. The maximum stable engine data transfer rate i could get using this smaller data package is around 80ms. Based on a calculation similar to above it should be much faster at below 30 ms....

28 bytes in kwp package
8 bit per byte plus start and stop bits => 280 bits
10400 baud = 10400 bits per sec => 37.14 packages per second
transfer rate = approx every 26.9 ms


__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1233
Date:

So this is as far as i have gotten. I am not sure what i will try next, I have hit a bit of a brick wall so i am open to suggestions.



__________________

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 Justin,
the baudrate ist not the only goal, take a look at at 800A01 and 800A16,
i think the receive interrupt is only every 100ms enable.

Boerd

-- Edited by Boerd on Sunday 5th of September 2010 10:24:03 AM

__________________


Guru

Status: Offline
Posts: 1233
Date:

Boerd wrote:

Hi Justin,
the baudrate ist not the only goal, take a look at at 800A01 and 800A16,
i think the receive interrupt is only every 100ms enable.

Boerd


Hi Boerd, thanks for contributing, this is exactly the type of into I was looking for, So if i understand correctly the important bit is bit 9 at 800A01 (R4MASK) which enables/disables the interrupt. and bit 3 at 800A16 which Enables reception on SI04?

i have traced through some of the references to these registers, there seem to be quite a few references. do you have any suggestions on the best way to enable the receive interrupt to process requests at a faster rate?


__________________

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:

I have now watched not just in the code, but I would have to program something I would do it this way:
KWP received, prevent receipt and return the requested data, released after a certain time,
the reception again. If you could share just after sending the data to receive back one block to the ECU.

For me, you must make first one flow chart of the ECU program to understand all the functions.

Boerd

__________________


Guru

Status: Offline
Posts: 1233
Date:

Boerd wrote:

I have now watched not just in the code, but I would have to program something I would do it this way:
KWP received, prevent receipt and return the requested data, released after a certain time,
the reception again. If you could share just after sending the data to receive back one block to the ECU.

For me, you must make first one flow chart of the ECU program to understand all the functions.

Boerd



Hi Boerd, If I understand you correctly you mean 

1) When KWP Received => Return requested KWP Data
2) Dont allow SIO4 to be disabled
3) Process next KWP request

I was also thinking about it slightly differently. It looks like the SIO4 is enabled in MJT input interrupt 0, which is a input multi junction timer. I think if i am reading the assembly correctly, this timer enables to SIO4 interrupt after a certain amount of time after the last KWP request and this may be what stops up from requesting data faster than every 100ms.

Do you think it would be a valid approach to decrease the timer duration so it enables SIO4 faster after each KWP request?


__________________

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:

jkwool wrote:
I was also thinking about it slightly differently. It looks like the SIO4 is enabled in MJT input interrupt 0, which is a input multi junction timer. I think if i am reading the assembly correctly, this timer enables to SIO4 interrupt after a certain amount of time after the last KWP request and this may be what stops up from requesting data faster than every 100ms.

Do you think it would be a valid approach to decrease the timer duration so it enables SIO4 faster after each KWP request?

 



This is exactly what I wanted to say, but do not decrease the timer too much the ECU need a little bit time for other thingswink

 



__________________


Guru

Status: Offline
Posts: 1233
Date:

Boerd wrote:

This is exactly what I wanted to say, but do not decrease the timer too much the ECU need a little bit time for other thingswink



I am trying to get my head around the timers, is there a specific setting that i can change to decrease the time for this function to run? or is it controlled within the function itself.

I can see in the code for the function that some comparisons are done before the SIO4 enable code is run

0x258 and 0x3FC

 

are these the numbers i should adjust or is there another way to change this?

 



__________________

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 have not tested this yet but I think the 2 values i need to change are at locations in the busa.bin file.

ROM_:0000EC50                 cmpui   R0, #0x2CEC

and

ROM_:0000EC60                 cmpui   R0, #0x34BD

If i am reading the assembly code correctly when unk_80452C is greater than these 2 values the following code runs which i think enables SIO4 so it can receive a new engine data request? So if i reduce these 2 values it should enable SIO4 more often which will allow more frequent engine data requests.

ROM_:0000EC88                 mv      R0, R1 || nop
ROM_:0000EC8C                 ld24    R1, #SIO45SEL_unk_800A02
ROM_:0000EC90                 stb     R0, @R1 || nop
ROM_:0000EC94                 ld24    R0, #SIO45MASK_unk_800A01
ROM_:0000EC98                 ldub    R1, @R0 || nop
ROM_:0000EC9C                 and3    R1, R1, #0xBF
ROM_:0000ECA0                 or3     R0, R1, #0x40
ROM_:0000ECA4                 ld24    R1, #SIO45MASK_unk_800A01
ROM_:0000ECA8                 stb     R0, @R1 || nop
ROM_:0000ECAC                 ld24    R0, #SIO4RCNT_unk_800A16
ROM_:0000ECB0                 ldub    R1, @R0 || nop
ROM_:0000ECB4                 and3    R1, R1, #0xEF
ROM_:0000ECB8                 or3     R0, R1, #0x10
ROM_:0000ECBC                 ld24    R1, #SIO4RCNT_unk_800A16
ROM_:0000ECC0                 stb     R0, @R1 || nop
ROM_:0000ECC4                 ld24    R1, #unk_804CBC
ROM_:0000ECC8                 ldi     R0, #1
ROM_:0000ECCA                 stb     R0, @R1
ROM_:0000ECCC                 ld24    R1, #unk_804CB6
ROM_:0000ECD0                 ldi     R0, #2
ROM_:0000ECD2                 stb     R0, @R1
ROM_:0000ECD4                 bra     loc_ECE0 || nop


I am still on a big learning curve with reading assembly so I could be very wrong on this, can anyone with more experience verify that i am on the right path?


__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1344
Date:

jk, are you using ida pro..., and what .idc file are you using...?

-- Edited by stocker on Wednesday 8th of September 2010 12:50:30 AM

__________________

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:

to be honest with you, i think only petrik, or boerd can answer this question with the right answer....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:

stocker wrote:

to be honest with you, i think only petrik, or boerd can answer this question with the right answer....smile




Yeah i think you might be right, i might send them an email and get their opinions :)



__________________

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 Justin,
sorry i have no much time for go through the code, but some infos:
the  timer is the TIO2 the reload value is 0x27F the timer counts down, is the timer 0 the timer interrupt is raised and the timer starts from 0x27F, i have not looking at the clock source but i think is easy.

Boerd

-- Edited by Boerd on Wednesday 8th of September 2010 07:31:46 AM

__________________


Guru

Status: Offline
Posts: 1233
Date:

Boerd wrote:

Hi Justin,
sorry i have no much time for go through the code, but some infos:
the  timer is the TIO2 the reload value is 0x27F the timer counts down, is the timer 0 the timer interrupt is raised and the timer starts from 0x27F, i have not looking at the clock source but i think is easy.

Boerd

-- Edited by Boerd on Wednesday 8th of September 2010 07:31:46 AM




No problems Boerd, I appreciate you taking the time to provide some useful info!

Thanks



__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1233
Date:

Ok, I am still trying to work this out as i am determined to get a faster data logging for Auto Tune :)

Here is some more info i have found, I will try to explain what i have found as i go. I am not sure if i am on the right track here. I dont know if the info below only relates to the initialization hand shake between the PC and the ECU or if its part of the main KWP processing to enable the SIO4 each time a new request is made?

I have found that the S4RCNT 00800A16 enable code runs in this interrupt vector

MJT Input Interrupt 0 Handler : 0x000000A4
IRQ8 : TIN7 - TIN11

In this interrupt handler TIO6RL0 0x00800366 is referenced as a counter source

TIO6 is configured like this
TIO6 Control Register (TIO6CR) : 0x0080036A
10101101
101 : Clock Bus 1
01 : External Input TIN8
101: Measure free-run input mode

TIN8 = P44

P4 Direction Register (P4DIR) : 0x00800724
Pn4DR Port Pn4 direction bit = 0 = Input

P4 Operation Mode Register (P4MOD) : 0x00800744
Port 44 Operation mode bit = 1 = CS0#/TIN8

P4 Peripheral Function Select Register (P4SMOD) : 0x00800764
P44SMD = 1 = TIN8

So what i am thinking is that MJT Input Interrupt 0 Handler is called from TIN8 which is called from P44. The SIO4 enabling code runs at location 0xEC68 (gen 2 busa) or location 0xEC68 (B-King) when the the difference between 2 Ram variables is between 0x2CEC and 0x34BD

maybe this is just for the initialization sequence?

Any thoughts?

__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1233
Date:

The 4 locations i have found where SIO4RCNT is enabled in the gen 2 busa bin are

ECB8
11B20
11E9C
11FBC






__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 2338
Date:

Justin, I believe you have spent more time than anyone else with SIO so dont know if can help you, but these two things hopefully can be food for thought:

1) In gen1 the timer calls a subroutine that sends enginedata, this happens at a certain interval. So I believe that the sio can not be real time response, rather the output must be limited to keep the more important ecu functions to run.

2) In the main loop the KWP protocol gets called by ROM_:000022B0 bl.l KWP_SIO_processing_sub_EEE0m, at least what I gather at first sight. Maybe there is something to be looked at for how often the SIO rutines get called ?



__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Veteran Member

Status: Offline
Posts: 98
Date:

PetriK wrote:
1) In gen1 the timer calls a subroutine that sends enginedata, this happens at a certain interval. So I believe that the sio can not be real time response, rather the output must be limited to keep the more important ecu functions to run.


2) In the main loop the KWP protocol gets called by ROM_:000022B0 bl.l KWP_SIO_processing_sub_EEE0m, at least what I gather at first sight. Maybe there is something to be looked at for how often the SIO rutines get called ?



Hi,
the ecu send the data over DMA, the cpu set only start and end adress for the ram and a start bit, that requires a very little time.

but for me it seems that the communication is time controlled.

Boerd

 



__________________


Guru

Status: Offline
Posts: 2338
Date:


In gen1 the DMA is separate to actual push the bits out function, not really sure about gen2. Gen1 push bits out was on a timer call, DMA was when packet is ready if I recall correctly.

But these functions above refer to main loop in gen2 and seem to have some kind of counters when to access SIO, have not had time to hack what it exactly does.


__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Guru

Status: Offline
Posts: 1233
Date:

I have tried changing the values in the functions that run in the main loop that look like they could be counters used to control when the SIO4 is enabled.

0x0000EFC6 : 0x258 => 0x12C
0x0000F052 : 0x3FC => 0x1FE
0x0000F072 : 0x3FC => 0x1FE
0x0000F12A : 0x105 => 0x82

I have tried changing these values individually and using different combinations but none of the changes seemed to make any difference to the rate at which i can request data from the ecu.

Do you think i am looking in the correct place? Are there any other things we could try?

__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 2338
Date:

After doing this sudoku for 30 minutes for now, I start to think that the send out data is only performed after Multijunction timer irq 5 interrupt. The current run rate is 8Hz was it ? The chain for innovate runs at 10Hz if I remember correctly so not so far off ?


ROM_:00002248 mainloop_loc_2248:                      ; CODE XREF: ROM_:loop_loc_2460j
ROM_:00002248                 ld24    R0, #mainloop_counter_unk_80420E
ROM_:0000224C                 ldub    R0, @R0
ROM_:0000224E                 addi    R0, #1
ROM_:00002250                 ld24    R1, #mainloop_counter_unk_80420E
ROM_:00002254                 stb     R0, @R1 || nop
ROM_:00002258                 bl.l    get_AD_sensor_values_and_main_fuel_and_ignition_calculations_sub_2468
ROM_:0000225C                 ld24    R0, #is_0xFF_if_adsensors_are_read_after_MJT_IRQ5_unk_804203
ROM_:00002260                 ldub    R0, @R0 || nop
ROM_:00002264                 beqz    R0, cont_loc_2274
ROM_:00002268                 ld24    R1, #is_0xFF_if_adsensors_are_read_after_MJT_IRQ5_unk_804203
ROM_:0000226C                 ldi8    R0, #0
ROM_:0000226E                 stb     R0, @R1
......

ROM_:00002274
ROM_:00002274 cont_loc_2274:                          ; CODE XREF: ROM_:00002264j
ROM_:00002274                 bl.s    get_AD_sensor_values_and_main_fuel_and_ignition_calculations_sub_2468 || nop
ROM_:00002278                 ld24    R0, #unk_804204
ROM_:0000227C                 ldub    R0, @R0 || nop
ROM_:00002280                 beqz    R0, loc_23E0
ROM_:00002284                 ld24    R1, #unk_804204
ROM_:00002288                 ldi8    R0, #0
ROM_:0000228A                 stb     R0, @R1
ROM_:0000228C                 ld24    R0, #bitflag_which_functions_to_execute_in_main_loop_unk_80420A
ROM_:00002290                 ldub    R0, @R0
ROM_:00002292                 addi    R0, #1
ROM_:00002294                 ld24    R1, #bitflag_which_functions_to_execute_in_main_loop_unk_80420A
ROM_:00002298                 stb     R0, @R1 || nop
ROM_:0000229C                 bl.l    initialize_ports_sub_5308
ROM_:000022A0                 bl.l    Read_port_flags_sub_123EC
ROM_:000022A4                 bl.l    transmit_gaugedata_sio2_sub_135FC
ROM_:000022A8                 bl.l    busa_different_to_bking_sub_140F4
ROM_:000022AC                 bl.l    process_KWP_sub_F6B0
ROM_:000022B0                 bl.l    KWP_SIO_processing_sub_EEE0


__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Guru

Status: Offline
Posts: 1233
Date:

PetriK wrote:

After doing this sudoku for 30 minutes for now, I start to think that the send out data is only performed after Multijunction timer irq 5 interrupt. The current run rate is 8Hz was it ? The chain for innovate runs at 10Hz if I remember correctly so not so far off ?


ROM_:00002248 mainloop_loc_2248:                      ; CODE XREF: ROM_:loop_loc_2460j
ROM_:00002248                 ld24    R0, #mainloop_counter_unk_80420E
ROM_:0000224C                 ldub    R0, @R0
ROM_:0000224E                 addi    R0, #1
ROM_:00002250                 ld24    R1, #mainloop_counter_unk_80420E
ROM_:00002254                 stb     R0, @R1 || nop
ROM_:00002258                 bl.l    get_AD_sensor_values_and_main_fuel_and_ignition_calculations_sub_2468
ROM_:0000225C                 ld24    R0, #is_0xFF_if_adsensors_are_read_after_MJT_IRQ5_unk_804203
ROM_:00002260                 ldub    R0, @R0 || nop
ROM_:00002264                 beqz    R0, cont_loc_2274
ROM_:00002268                 ld24    R1, #is_0xFF_if_adsensors_are_read_after_MJT_IRQ5_unk_804203
ROM_:0000226C                 ldi8    R0, #0
ROM_:0000226E                 stb     R0, @R1
......

ROM_:00002274
ROM_:00002274 cont_loc_2274:                          ; CODE XREF: ROM_:00002264j
ROM_:00002274                 bl.s    get_AD_sensor_values_and_main_fuel_and_ignition_calculations_sub_2468 || nop
ROM_:00002278                 ld24    R0, #unk_804204
ROM_:0000227C                 ldub    R0, @R0 || nop
ROM_:00002280                 beqz    R0, loc_23E0
ROM_:00002284                 ld24    R1, #unk_804204
ROM_:00002288                 ldi8    R0, #0
ROM_:0000228A                 stb     R0, @R1
ROM_:0000228C                 ld24    R0, #bitflag_which_functions_to_execute_in_main_loop_unk_80420A
ROM_:00002290                 ldub    R0, @R0
ROM_:00002292                 addi    R0, #1
ROM_:00002294                 ld24    R1, #bitflag_which_functions_to_execute_in_main_loop_unk_80420A
ROM_:00002298                 stb     R0, @R1 || nop
ROM_:0000229C                 bl.l    initialize_ports_sub_5308
ROM_:000022A0                 bl.l    Read_port_flags_sub_123EC
ROM_:000022A4                 bl.l    transmit_gaugedata_sio2_sub_135FC
ROM_:000022A8                 bl.l    busa_different_to_bking_sub_140F4
ROM_:000022AC                 bl.l    process_KWP_sub_F6B0
ROM_:000022B0                 bl.l    KWP_SIO_processing_sub_EEE0



Yes this is very much a puzzle :) and one worth solving!

Current engine data is only reliable at around 150 ms = 6.67 hz , by increasing the baud rate to 50, 000 i have been able to request engine data every 100ms = 10hz but this is only working on the bench and not when ecu is in bikes.

LC-1 data rate is approximately every 82ms or 12.2 Hz. We are not restricted by the LC-1 data bus as we are taking a direct 0-5v feed from the LC-1 so my goal is to be able to request data every 50ms = 20Hz

Do you think that we should be looking in the MJT output interrupt 5 IRQ5 interrupt routine? or the code that enables or controls this interrupt?



__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 2338
Date:

What I gather the MJT sets is_0xFF_if_adsensors_are_read_after_MJT_IRQ5_unk_804203 which then is used to select if eg. the following is run.

ROM_:000022A4 bl.l transmit_gaugedata_sio2_sub_135FC
ROM_:000022AC bl.l process_KWP_sub_F6B0
ROM_:000022B0 bl.l KWP_SIO_processing_sub_EEE0

There is propably more to this, but this is as far as I got yesterday.

__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Guru

Status: Offline
Posts: 1233
Date:

ok great, i will take a look at this tonight and see what i can make of it.

Thanks Petri.

__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1233
Date:

Petri, I followed your logic through and I changed the counter for MJT IRQ5 and also the reset value for this counter at the following locations

TOP10CT : 0x000012B70 - 0x1F4 => 0xFA
TOP10RL : 0x000012BEE - 0x1F3 => 0xF9

AND IT WORKED!!!!!!

I have been able to log engine data, both on the bench and on my bike, with a timer setting of 50ms which translates to about every 65ms when data processing is taken into account!!!

I have not been able to test the logging with the engine running as it is getting too late here to start my bike up, I plan to do some proper real world testing tomorrow and if all goes well i will do a release over the weekend.

Thanks heaps for putting me in the right direction Petri, your help is really appreciated!

Thanks also to Boerd for contributing to this hack!

Cheers
-Justin.


-- Edited by jkwool on Friday 24th of September 2010 10:17:48 AM

__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1344
Date:

this is great news, good job justin.....and thanks to petrik, and bored.....can't wait for the primer2..........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:

stocker wrote:

this is great news, good job justin.....and thanks to petrik, and bored.....can't wait for the primer2..........smile




Yeah me too, now that it seems we have the data rate sorted its full speed ahead on Primer 2.



__________________

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 Justin,

please make the first test also with high rpm without driving!!!!

You have also speed up many other function.

After this test and all is working i change the timing into the primer and send you the code.

Boerd

__________________


Guru

Status: Offline
Posts: 1233
Date:

Boerd wrote:

Hi Justin,

please make the first test also with high rpm without driving!!!!

You have also speed up many other function.

After this test and all is working i change the timing into the primer and send you the code.

Boerd




Hi Boerd,

I agree, that is why i have not done a release yet as i want to check that the engine is functioning correctly first before unleashing the code.  Fingers crossed!

Cheers



__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1233
Date:

When testing on bike with engine running, there is no effect on engine with the timer MJT IRQ 5 set to a higher rate, i warmed the bike up and revved it and it ran clean with no mis fires etc.

Unfortunately when the engine running the data logging at the faster rate is not working correctly, its like the timer function is affected when the engine is started. With the engine not running the faster log rate works 100% but as soon as the engine is started it does not seem to work.

My thoughts are
  1. the IRQ 5 timer may be disabled or controlled elsewhere in the code
  2. There could be interrupts with higher priorities that prevent the timer from running when the engine is running
  3. There could be electrical interference that is affecting the serial signal


__________________

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:

Hey Justin
when do you plan on releasing the software for the primer 2?

__________________


Guru

Status: Offline
Posts: 2338
Date:


This may be too basic questions, but have you looked into searching (ctrl T) for the ram adress 80xxxx which is MJT5 downcount timer or alike ?

Well done with all the progress !!!





__________________

When asking a question, you can also consider posting it to facebook:

http://www.facebook.com/ecueditorcom



Guru

Status: Offline
Posts: 1233
Date:

PetriK wrote:


This may be too basic questions, but have you looked into searching (ctrl T) for the ram adress 80xxxx which is MJT5 downcount timer or alike ?

Well done with all the progress !!!




Hi Petri,

I have not searched for the text but i have right clicked on the variables and clicked "Jump to xref to operand" which generally shows all code locations that reference the variable/memory location. There is only one reference for the counter and one reference for the reload for TOP10 both of which are in the function init_TOP_sub_12AC4

8002E0 TOP10CT -> 00012B6C

8002E2 TOP10RL -> 00012BE8

I am still not certain if the problem i am having is related to electrical interference etc so i would like to see if this works for others with the engine running. Rolf has been able to run the fast baud rate and log data with the engine running but it did not seem to be saving the data at the 50ms interval, it was more like 100ms..

I might hook up my oscilloscope to the serial line on my bike and start the engine to see if i can detect any weired stuff going on with the serial signal.

Petri are you aware of any flags that indicate when the engine is running and are used to run certain code only when the engine is running?



__________________

site_logo_small.png

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



Guru

Status: Offline
Posts: 1233
Date:

slantman wrote:

Hey Justin
when do you plan on releasing the software for the primer 2?



I am having a few issues with a couple of sections of code that i am working to resolve before being able to release anything, Boerd is also developing some software to run on the Primer 2 for engine logging.

I will let you know when i have any interesting updates.

 



__________________

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:

the only problem i am have is getting my password for the primer2 site.
i have registered with two different email accounts and still have not received a password

__________________


Guru

Status: Offline
Posts: 1233
Date:

slantman wrote:

the only problem i am have is getting my password for the primer2 site.
i have registered with two different email accounts and still have not received a password




weird, they were down for maintenance last week for days and days so it may be related to that. it has not gone to spam or something has it?



__________________

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:

Hallo,

i can sent the code for the primer2 that display the engine-data on the lcd, also i can
easy change the code to fast logging.

a other way is we logging the TPS, RPM, AFR, SAP and IAP direct with the primer so i
have begin to write some code that logg this values every 6,25ms, but for this way i
need some infos for the sensors iap and sap and we must have 4 new wires on the bike.cry

or someone help me at the M32R-Simulator projekt, i thing that not the fastest way but the best way for the future.

Boerd


__________________
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