Segmenting a complex bit of hardware-two STM32F4's
Posted: Thu Mar 17, 2022 4:07 am
I am working on an engine control computer project based around Speeduino, that already exists on STM32. It does a solid 90% of what I want it to do, however the hardware available is not built to the durability standard I want, so I'll build my own. I have no worries about the hardware design, that's what I do-the coding is what will be difficult for me.
Currently, the main project runs on an STM32F4XX, I will be using an STM32F407VGT6 or an STM32F417ZGT6 as the main processor. The 407VGT6 is the preferred target due to some communications issues that haven't been worked out yet. This part is not too difficult to work with.
The problems come up with the drive-by-wire system. It will require some hardware redundancies, which are already worked out-the throttle pedal and throttle body-the OEM redundant systems are good enough. All-in-all, I will need to read 4 potentiometers, drive an H-bridge motor amplifier, generate an analog throttle position signal, and maintain a communication link (I'm thinking SPI would be appropriate) back to the main processor.
First, do I need the multiple ADCs of the STM32F303(hard to get right now!), or will the STM32F401 with its single ADC be enough to sample the four potentiometers? The advantage is that if I offload the drive-by-wire duties, I won't have the main processor loop clogging up ADC reads or position commands.
Next, the SPI communications. I want to report back to the main processor with a data packet that includes the TPS value (in addition to the analog value), a fault status (four potentiometers plus a motor control circuit) and a "follower error" that includes the measured throttle position deviation from the commanded value. This seems trivial on the hardware side. Any gotchas to look for as I lay out the hardware to do this?
I've seen a few examples out there in the wild, and the hardware is not too complicated. It's that hardware/software interface that I am concerned with. I don't want to lay out a hardware system that puts up roadblocks for the software to deal with-I'm not a good enough programmer to program around badly designed hardware!
Currently, the main project runs on an STM32F4XX, I will be using an STM32F407VGT6 or an STM32F417ZGT6 as the main processor. The 407VGT6 is the preferred target due to some communications issues that haven't been worked out yet. This part is not too difficult to work with.
The problems come up with the drive-by-wire system. It will require some hardware redundancies, which are already worked out-the throttle pedal and throttle body-the OEM redundant systems are good enough. All-in-all, I will need to read 4 potentiometers, drive an H-bridge motor amplifier, generate an analog throttle position signal, and maintain a communication link (I'm thinking SPI would be appropriate) back to the main processor.
First, do I need the multiple ADCs of the STM32F303(hard to get right now!), or will the STM32F401 with its single ADC be enough to sample the four potentiometers? The advantage is that if I offload the drive-by-wire duties, I won't have the main processor loop clogging up ADC reads or position commands.
Next, the SPI communications. I want to report back to the main processor with a data packet that includes the TPS value (in addition to the analog value), a fault status (four potentiometers plus a motor control circuit) and a "follower error" that includes the measured throttle position deviation from the commanded value. This seems trivial on the hardware side. Any gotchas to look for as I lay out the hardware to do this?
I've seen a few examples out there in the wild, and the hardware is not too complicated. It's that hardware/software interface that I am concerned with. I don't want to lay out a hardware system that puts up roadblocks for the software to deal with-I'm not a good enough programmer to program around badly designed hardware!