SPI bus

Hardware inside and outside of the ECU
Post Reply
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

SPI bus

Post by AndreyB »

Let's discuss our approach to SPI bus.

SPI has three signal wires (clock, master out, master in) and, if we want to have multiple devices on sharing the same bus, a Chip Select wire - which is just a GPIO wire which tells the slave chip that it 'owns' the bus at the moment. So, three shared wires plus one wire per device.

stm32f4discovery has all there SPI buses exposed but I personally prefer SPI2 which is PB13-PB14-PB15. TODO: figure out why PB4 does not work for me and maybe use PB3-PB4-PB5 instead. I suggest we use a 10x2 flat ribbon cable which would carry three SPI signals and as many CS wires as possible.

Open question: should we have GND or +5v in the same 20 wire flat ribbon cable?

First of all, we need to figure out what are the SPI devices we might need.
1) SD card in SPI mode (pretty much mandatory)
2) HIP DD chip (pretty much mandatory)
3) programmable amplifier for software detonation detection (optional)
4) x2 digital potentiometer for stimulation mode (totally optional)
5) 'smart' drivers like TLE6240 (pretty optional)
6) thermocouple drivers (pretty optional)
7) tiny LCD screen (very optional)

What else?
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
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: SPI bus

Post by kb1gtt »

I would add thermocouple to the list.

I would also say yes we want 3.3V and GND, such that devices are powered via this SPI bus. Can we mimic the UEXT connector such that we can use existing Olimex boards? https://www.olimex.com/Products/Modules/UEXT/ They have many ready made devices including LCD, RF communications, GPS, Accelerometers, thermocouple and gyro.

Doing that would also work well for folks that use Olimex boards as those typically come with UEXT connectors.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: SPI bus

Post by AndreyB »

I've checked the UEXT connected and while we would make something VERY similar, we need something different.

We can probably make an attempt to be UEXT-compatible to some extent:

1 3.3V we can do this
2 GND we can do this
3 TXD we do not need this
4 RXD we do not need this
5 SCL we do not need this
6 SDA we do not need this
7 MISO we can do this
8 MOSI we can do this
9 SCK we can do this
10 SSEL we can do this

So, we can keep the layout of 3.3, GND and SPI pins but I do not see much use of RS232 and I2C. I'd rather use these four pins as four more SSEL lines. Technically we also need +5 line, so that would mean four SPI lines in the header, but I guess four SPI lines should be more than enough to begin with.
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