cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to remap SPI pins to a different GPIO in an STM32G4 ?

BuggyCode
Associate II

I am working on a project using STMCubeMX and an STM32G4 i would like to remap the MISO and MOSI pins, if I were to remap PB4 -> SPI_1_MISO to SPI_1_MOSI and viceversa with PB5 -> SPI_1_MOSI to SPI_1_MISO.

I have a Custom PCB with two STM32G4 communicating over SPI, by mistake I have connected PB4 coming from the master device to PB5 on the slave device , and now I am just wondering if it is possible to remap those two pins, according to the datasheet it does not look promising.

As shown here: PB4 has to be SPI_MISO and PB5 has to be SPI_MOSI.

0693W000003RPO9QAO.png

Does anyone know about a workaround for this ?

Thanks

6 REPLIES 6
Peter BENSCH
ST Employee

No, unfortunately no chance to exchange the pins internally.

BTW: when looking for a possible solution, it is always a good idea to include the necessary details, in this case e.g. that you are talking about an STM32G431.

Good luck with rewiring the pins externally!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Uwe Bonnes
Principal III

If speed allows, use bitbanging SPI.

I think this is going to be my only alternative, since it is not possible to exchange the pins internally, do you know where I could find some examples of bitbanging SPI ?

What do you mean by " if speed allows ?" is it the speed at which the CPU is runnning or the specific GPIOs ?

Thank you for your time.

Uwe Bonnes
Principal III

Bitbanging either hogs the CPU or is slow. So speed may be an issue.

is it feasible to use bitbanging in this particular case instead of having to rewire the pins externally ?

Thank you for your time.

You can use BIDIMODE, although it's quite a PITA... :)

JW