Page 1 of 1

micro rusEFI and MAX31855 SPI

Posted: Wed Dec 04, 2024 3:45 pm
by chili023
Hi from Berlin.
I am trying to get the SPI3 running on microrusEFI.
Is it correct that I need custom firmware to activate the SPI3?
I want to use PB9 PC10 and PC11 on J4.

Thanks

Re: micro rusEFI and MAX31855 SPI

Posted: Wed Dec 04, 2024 6:06 pm
by JRD McLAREN
Look at this... https://rusefi.com/forum/viewtopic.php?f=4&t=2215&start=30

..(netreba vymyslat teplu vodu .. :mrgreen: ) ..

Re: micro rusEFI and MAX31855 SPI

Posted: Wed Dec 04, 2024 6:20 pm
by AndreyB
chili023 wrote:
Wed Dec 04, 2024 3:45 pm
Is it correct that I need custom firmware to activate the SPI3?
Maybe better question why is SPI3 not available on microrusEFI in the first place. Is that some sort of DMA conflict?

More or less https://en.wikipedia.org/wiki/XY_problem blah blah blah

Re: micro rusEFI and MAX31855 SPI

Posted: Wed Dec 04, 2024 6:50 pm
by chili023
Hi. I do not know why it would be dissabled
in the board_configuration.cpp the SPI3 is not enabled in setBoardConfigOverrides()

Code: Select all

void setBoardConfigOverrides() {

	// SPI3 for expansion header
	// Don't override enable since you might want these pins for something else
	engineConfiguration->spi3mosiPin = Gpio::C12;
	engineConfiguration->spi3misoPin = Gpio::C11;
	engineConfiguration->spi3sckPin = Gpio::C10;
}
I want to change that to

Code: Select all

void setBoardConfigOverrides() {

	// SPI3 for expansion header
	// Don't override enable since you might want these pins for something else
	engineConfiguration->is_enabled_spi_3 = true;
	//engineConfiguration->spi3mosiPin = Gpio::C12;
	engineConfiguration->spi3misoPin = Gpio::C11;
	engineConfiguration->spi3sckPin = Gpio::C10;
}
I am trying to compile the new code but it interrupts with errors.
Is this the correct way?

Re: micro rusEFI and MAX31855 SPI

Posted: Thu Dec 05, 2024 7:34 am
by chili023
Nobody who can point me into the right direction?
Is this problem so hard to solve? Are my simple questions so hard to answer?

Seams rusEFI user support is the biggest drawback compared to other ECUs.

Consoering the overal plan for our project.
Integrate BME280
Integrate Mazda incylinder pressure transducer
traction controll
and many more.

I am fearing this forum cannot support us with the support we need.

I am trying to install the toolchain to compile my own firmware but I still do not know if this is the correct way to use a simple chip like the MAX31855

Re: micro rusEFI and MAX31855 SPI

Posted: Thu Dec 05, 2024 8:46 am
by chili023
Hi found this in the board.mk of the microrusEFI.
We have MRE 0.6.0 so we should be able to use SPI3 on J4. SPI2 is handling the SD Card. Am I correct?

Code: Select all

# Combine the related files for a specific platform and MCU.

# *TEMPORARY* breaking TTL thus breaking Bluetooth for microRusEFI in order to enable SPI3 for SD card
# *TODO* need to give people the horrible choice between Bluetooth via TTL or SD card via SPI :( horrible choice
# PB10/PB11 uses UART3 peripheral and J12/J13 on MRE
# we also have PC10/PC11 exposed on J4 but that's same UART3
DDEFS += -DEFI_CONSOLE_TX_BRAIN_PIN=Gpio::B10 -DEFI_CONSOLE_RX_BRAIN_PIN=Gpio::B11

# on[b] MRE 0.6.0[/b] we have SD card on SPI2 which shared channel 3 with USART3
# todo: enable serial which would not DMA thus not conflict?
DDEFS += -DSTM32_UART_USE_USART3=FALSE -DHAL_USE_UART=FALSE
DDEFS += -DEFI_USE_UART_DMA=FALSE

Re: micro rusEFI and MAX31855 SPI

Posted: Thu Dec 05, 2024 11:28 am
by JRD McLAREN
So ...
try simple thing...

Enable SPI3 interface on TunerStudio ... (try to look at my Online tune ..)
..it can be enabled .. I think ..

My MRE and addon board has SD card slot and EGT chip wired to SPI3 interface..
..and it works ...
..so I have old firmware, on my very first MRE, build by myself .. few years ago ..

Re: micro rusEFI and MAX31855 SPI

Posted: Thu Dec 05, 2024 11:46 am
by chili023
Hi JRD
Thanks for the reply. I have edited the tunerstudio mainController.ini file and enabled SPI3 setings in full pinout 1/3

Code: Select all

dialog = spiBus3, "SPI3 settings"
		field = "Enable",								is_enabled_spi_3
image.png
However SPI3 is not enabled in microrusEFI?!?! (Still a question) I think.
in board_configuration for microrusefi in .\rusefi-SR1\firmware\config\boards\microrusefi

the SPI3 is not specifically enabled, as far as I see. SPI1 and 2 are though.
engineConfiguration->is_enabled_spi_1 = true;
engineConfiguration->is_enabled_spi_2 = true;
is present
engineConfiguration->is_enabled_spi_3 = true; not.

Is this correct?

It is also not found in any other files that will be compiled for the latest firmware. So I assume I have to enable spi3 and compile a custom firmware correct?

Re: micro rusEFI and MAX31855 SPI

Posted: Thu Dec 05, 2024 12:02 pm
by JRD McLAREN
So ..
I have stock firmware..

do not edit inifile... it is not right way to configure MRE..

use stock ini file, create project in TS ...
and then go to Controler > SPI > and set SPI3 enable to true

Re: micro rusEFI and MAX31855 SPI

Posted: Thu Dec 05, 2024 1:29 pm
by chili023
Hi. There is no option SPI3 if I use the standard ini.
It looks like this:
image.png
If i try to configure SPI4 to 6 it always tells me that my board is equipped with it.
image.png
SPI1 talkes to t8888 and SPI2 to the SD card. So I have to use SPI3.

Re: micro rusEFI and MAX31855 SPI

Posted: Thu Dec 05, 2024 2:10 pm
by chili023
I was able to get the toolchain running on a Ubuntu vm.
I flashed a custom rusefi.bin using the MRE updater.
However now I cannot upload any more firmware because the update program thinks the connected board is not the MRE.
I screwed up with the board definition.

Is there a work around or do I have to write the chip directly no with a link programmer?
image.png

Re: micro rusEFI and MAX31855 SPI

Posted: Thu Dec 05, 2024 2:25 pm
by AndreyB