LUA code and EGT makes ECU to hang

Post Reply
zed65
Posts: 44
Joined: Sun Sep 24, 2023 5:43 pm

LUA code and EGT makes ECU to hang

Post by zed65 »

I'm having a weird problem with some LUA code and SPI EGT that makes the processor to hang.
Here is a guide to replicate my problem.

1. Flash the latest bundle to a F407 (black-board in my case).
2. Open console and write this into LUA:

Code: Select all

function onTick()
    adv = getOutput ("correctedIgnitionAdvance")
    print (adv)
end
3. Open Tunerstudio, create a new project.
4. Turn on EGT SPI, (tried with SPI1,2and3, same problem).
egtSpiHang.png
egtSpiHang.png (489.39 KiB) Viewed 1382 times

5. Reboot the processor.
6. It freezes in a couple of seconds (1-30sec).

The weird thing is that it seems to only affect the getOutput() command in LUA, everything else seems to work regarding LUA.
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: LUA code and EGT makes ECU to hang

Post by AndreyB »

zed65 wrote:
Sun Jan 28, 2024 12:33 pm
black-board in my case
Where does one get a black-board to test? is this reproducible on naked stm32f4discovery?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
zed65
Posts: 44
Joined: Sun Sep 24, 2023 5:43 pm

Re: LUA code and EGT makes ECU to hang

Post by zed65 »

Search STM32F407VGT6 on Aliexpress

I think it will produce the same on a stm32f4discovery but i'm not 100%
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: LUA code and EGT makes ECU to hang

Post by AndreyB »

zed65 wrote:
Sun Jan 28, 2024 5:35 pm
Search STM32F407VGT6 on Aliexpress

I think it will produce the same on a stm32f4discovery but i'm not 100%
Oh so that's without actual EGT chip present?

Please link your complete tune just in case.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
zed65
Posts: 44
Joined: Sun Sep 24, 2023 5:43 pm

Re: LUA code and EGT makes ECU to hang

Post by zed65 »

Yes, that's without the chip installed.
Let me get my actual ECU from my car (chip is present) and I check on that one.
zed65
Posts: 44
Joined: Sun Sep 24, 2023 5:43 pm

Re: LUA code and EGT makes ECU to hang

Post by zed65 »

Sadly it don't work on that either.
I tried both with and without an actual K-type sensor connected.
mck1117
running engine in first post
running engine in first post
Posts: 1494
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish

Re: LUA code and EGT makes ECU to hang

Post by mck1117 »

andrey you should go look at the call to getMax31855EgtValue in status_loop.cpp and see if the things done in getMax31855EgtValue are a good idea to call from an arbitrary lua call stack
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: LUA code and EGT makes ECU to hang

Post by AndreyB »

mck1117 wrote:
Tue Jan 30, 2024 10:16 pm
andrey you should go look at the call to getMax31855EgtValue in status_loop.cpp and see if the things done in getMax31855EgtValue are a good idea to call from an arbitrary lua call stack
Thank you! I've changed things https://github.com/rusefi/rusefi/commit/324378f252b049a5f83f0f42a9f44e54741ee349
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply