New to Communication protocols (or any form of firmware developments tbh) and have more of a conceptual question. I can provide more information as needed.
The System Topology is:
- An ST M4 MCU which acts as the "Brain" of the system. This MCU lies on a PCB we can call the "Parent Board". It will have 3 to 9 "Daughter PCB's"
- An ST M3 MCU on the "Daughter PCB" Which acts as the brain for each daughter board.
- A Motor Controller (Could be Brushless DC or Stepper) which is located on the "Daughter PCB" This motor controller communicates with the M3 MCU over SPI and there are libraries which can be used as a starting point to build the design. For instance if the motor is PowerStep01 there exist .c and .h files that I can probably integrate with the M3 MCU.
Hopefully I've done a decent job explaining my setup.
Where my problem comes from is this. To me (Analog Electronics background) SPI is the best choice for Comms between the M4 and M3 because I can use Chip select to talk to whichever MCU on the daughterboard I am using. But i keep getting pushback on implementing SPI between the M4 and M3. Assuming the Libraries for the PowerSTep01 lies on the M3 MCU how will the M4 be able to tell the M3 exactly what to do? My thought was that there will be some sort of translation layer between the M4 and M3 which would the "Access" the Libraries the Motor Controller needs? Does this make sense? or is this just a very difficult thing to create in FW. Or does having some 1-1 UART line for each of the "Daughter boards" make writing the Firmware a lot easier?
Ive rambled a bit here, but hopefully my struggles are being conveyed
i haven't done that much to implement a solution yet, very much in the system block level, but what i will want is for the M4 to be able to issue a command (eg. go to position 200 from position 0) and the M3 should be able to say either
- I am connected to a Stepper motor so let me move 200 steps to get to this position; or
- I am connected to a BLDC so let me apply current to the motor to get it to move to position 200
the M3 will then communicate over SPI to the Motor controller it is connected to over SPI by leveraging existing libraries.