2012-07-25 01:47 AM
I am using the STM32F103C8T6. I notice that some of the peripherals share the same pins. What I am wondering is whether it is possible to use these peripherals in these circumstances.
The specific case I am looking at are UART3 and SPI2, neither of which can be re-mapped (not on the version of the device I am using) Now UART3 is on pins PB10, PB11, PB12, PB13 and PB14 (I am only interested in TX and RX on PB10 and PB11), whereas SPI2 is on pins PB12, PB13, PB14, PB15 ( I am only interested in SCK, MISO and MOSI on PB13, PB14, PB15) Is it possible to use both peripherals in this way? If so what mechanism stops the UART CTS and RTS functions affecting the SPI2 SCK and MISO functions? Thanks in advance Nick #peripherals-stm32f103c8t62012-07-25 02:16 AM
You can certainly change the pin assignment at runtime when assigning the pins to another alternate function, and de-initializing the other peripheral before.
However, you still need to keep external circuitry from interfering with it. Shutting down the UART will not keep an external device from sending, thus affecting the former RX pin for instance.2012-07-25 04:04 AM
Thanks for the response.
I actually would like to use both peripherals at the same time. This is what I want to check if it is possible or not.2012-07-25 04:25 AM
I have not been looking at the datasheet you actually want to use, but this is basically always the same. The selection of the 'Alternate Function' of the pin(s) is an either-or choice.
A usage at the same time is not possible, at least for the same pin. Several peripherals are routed to different pins or pin sets, especially UART and I2C/SPI. I would double check if not one slipped through.2012-07-25 12:58 PM
Look at the datasheet of microcontroller,
and use the GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState)I hope SPI or USART have another pins, if you use Remap Function you can use these peripherals2012-07-25 01:33 PM
''what mechanism stops the UART CTS and RTS functions affecting the SPI2 SCK and MISO functions?''
If you don't configure the pins for the CTS and RTS alternate functions, then they are available for other uses...2012-07-25 10:21 PM
That is correct.
I understood the first post that he intents : 1. use both peripherals at the same time 2. use the UART with hardware handshake, i.e. RX/TX and CTS/RTS That is not possible with just one set of pins.2012-07-26 12:16 AM
ST's tool, ''MicroXplorer - MCU graphical configuration tool'' is useful as it quickly shows where alternative functions are mapped to pins. Unfortunately, it seems to assign functions as complete blocks although as Neil says, you don't have to configure all the pins of a USART if for example you only want TX /RX.
Quickest way to find the tool is just Google ''STM32 MicroXplorer''.2012-07-26 11:06 AM
''I understood the first post that he intents ... use the UART with hardware handshake, i.e. RX/TX and CTS/RTS''
No: he specifically said that he is interested in Rx and Tx only - ie, not CTS & RTS.2012-07-26 11:39 AM
Maybe you could be more specific which peripherals exactly you'd like to use.