Software knock processing

It's all about the code!
Post Reply
User avatar
russian
Site Admin
Posts: 9673
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Software knock processing

Post by russian » Sat Dec 29, 2018 4:54 am

mobyfab wrote:
Sat Dec 29, 2018 1:21 am
HIP9011 that can be done in software. (I've done it)
Can you please elaborate? I would love to have working knock detection in rusEfi. At the moment it's not working :(
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

User avatar
mobyfab
Posts: 137
Joined: Tue Oct 29, 2013 10:09 am
Location: Versailles, France
Soldering skill: yes
Coding skill?: yes

Re: Software knock processing

Post by mobyfab » Sat Dec 29, 2018 6:01 pm

You can read my code:
https://github.com/fpoussin/MotoLink/bl ... ain.c#L460

it uses about 30-35% cpu on my STM32F3. I am sampling at 115KHz, processing 1024 samples to FFT512 (256 bins).
it should be around 15% cpu on the STM32F405.

Keep in mind you would need a dedicated ADC to sample this because of the high sampling frequency.
Last edited by mobyfab on Sat Dec 29, 2018 6:14 pm, edited 1 time in total.

User avatar
russian
Site Admin
Posts: 9673
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Software knock processing

Post by russian » Sat Dec 29, 2018 6:06 pm

mobyfab wrote:
Sat Dec 29, 2018 6:01 pm
You can read my code:

https://github.com/fpoussin/MotoLink/bl ... ain.c#L460
Any chance for you to start a new thread and elaborate on all this? Some overview and status and limitations and hardware requirements etc? Pretty please :)
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

mck1117
running engine in first post
running engine in first post
Posts: 241
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish
Soldering skill: yes
Coding skill?: yes

Re: Software knock processing

Post by mck1117 » Sat Dec 29, 2018 11:25 pm

mobyfab wrote:
Sat Dec 29, 2018 6:01 pm
it uses about 30-35% cpu on my STM32F3. I am sampling at 115KHz, processing 1024 samples to FFT512 (256 bins).
it should be around 15% cpu on the STM32F405.
And if we don't want to cram it in to the main ECU's processor, it is probably much safer (for longevity and flexibility) to use a second microcontroller (something small like stm32f334 or 373 in lqfp48) than an asic like the hip9011.

Also makes development easier, as that CPU can focus on just sampling and DSP, instead of that on top of running the engine too.

puff
contributor
contributor
Posts: 2733
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: Software knock processing

Post by puff » Sat Dec 29, 2018 11:29 pm

lost the plot. what was the idea of avoiding hip9011? was it hard to obtain or hard to set up?

mck1117
running engine in first post
running engine in first post
Posts: 241
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish
Soldering skill: yes
Coding skill?: yes

Re: Software knock processing

Post by mck1117 » Sat Dec 29, 2018 11:32 pm

Ooh, the stm32f373 also has a 16-bit sigma-delta ADC, with a programmable gain input. Gains of 0.5x to 32x, in 7 steps.

User avatar
kb1gtt
contributor
contributor
Posts: 3469
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA
Contact:

Re: Software knock processing

Post by kb1gtt » Sat Dec 29, 2018 11:41 pm

puff wrote:
Sat Dec 29, 2018 11:29 pm
lost the plot. what was the idea of avoiding hip9011? was it hard to obtain or hard to set up?
Currently we do not have a working chip. The key problem is getting the XTAL to start reliably. A second problem is getting the parameters programmed correctly. Every engine will want different parameters. The chip prevents us from being able to share information which is valuable when tuning the knock detection. Doing this ourselves would allow access to low level information. That low level information is handy to know for tuning purposes. As well it would allow us to make a circuit that works.
Welcome to the friendlier side of internet crazy :)

puff
contributor
contributor
Posts: 2733
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: Software knock processing

Post by puff » Sun Dec 30, 2018 12:08 am

I thought @andreika got it working. As far as I got, you'd have to set individual thresholds and windows for each engine anyway?

User avatar
mobyfab
Posts: 137
Joined: Tue Oct 29, 2013 10:09 am
Location: Versailles, France
Soldering skill: yes
Coding skill?: yes

Re: Software knock processing

Post by mobyfab » Sun Dec 30, 2018 12:16 am

mck1117 wrote:
Sat Dec 29, 2018 11:25 pm
mobyfab wrote:
Sat Dec 29, 2018 6:01 pm
it uses about 30-35% cpu on my STM32F3. I am sampling at 115KHz, processing 1024 samples to FFT512 (256 bins).
it should be around 15% cpu on the STM32F405.
And if we don't want to cram it in to the main ECU's processor, it is probably much safer (for longevity and flexibility) to use a second microcontroller (something small like stm32f334 or 373 in lqfp48) than an asic like the hip9011.

Also makes development easier, as that CPU can focus on just sampling and DSP, instead of that on top of running the engine too.
This is running from the CCM, it would probably be 45-50% from flash.
We could use a QFP36 chip for that, they have a larger pitch of 0.65mm.

The sigma delta ADC is too slow for this, and 12bit is plenty.
The F3 has op amps with PGAs.
F301-303 is the best candidate IMO, you don't need any of the fancy stuff from other series.

User avatar
russian
Site Admin
Posts: 9673
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Software knock processing

Post by russian » Sun Dec 30, 2018 12:19 am

mobyfab wrote:
Sun Dec 30, 2018 12:16 am
This is running from the CCM, it would probably be 45-50% from flash.
We could use a QFP36 chip for that, they have a larger pitch of 0.65mm.

The sigma delta ADC is too slow for this, and 12bit is plenty.
The F3 has op amps with PGAs.
F301-303 is the best candidate IMO, you don't need any of the fancy stuff from other series.
Let's chat at https://rusefi.slack.com/messages/CF3K8DX26?
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

Post Reply