Skip to main content
FLast.17.70
Associate II
October 23, 2017
Question

Same AFIO mapped to multiple pins

  • October 23, 2017
  • 5 replies
  • 2373 views
Posted on October 23, 2017 at 12:53

Is it OK to map the same alternate function to multiple pins? 

I'm using an STM32F767 DFSDM module and I want to output the DFSDM clock both on PC2  and PD10 (for PCB routing reasons, outputting the clock on PC2 would route neatly with DFSDM channels 0 and 4; and likewise also outputting the same clock on PD10 would make routing easy for channels 1 and 2 on PB12 and PB14).

I have tried it in the firmware and it works (I can see the clock on the scope) but ST32CubeMX does not allow me to do this. It only seems to allow the choice of one pin for a particular function.

Is this 'legit'? 

    This topic has been closed for replies.

    5 replies

    Technical Moderator
    October 23, 2017
    Posted on October 23, 2017 at 15:58

    Hello,

    You have an option in STM32CubeMX that highlights in blue the alternate pins when there are some available:

    You should press the <ctrl> key and click the pin of interest on STM32CubeMX chip view, if any alternate pins available, they will be shown in blue.

    You can check the specific alternate function assignments for each pin which are detailed in the datasheet, in the table (STM32F765xx, STM32F767xx, STM32F768Ax and STM32F769xx alternate function mapping)

    Best Regards

    Imen

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
    waclawek.jan
    Super User
    October 23, 2017
    Posted on October 23, 2017 at 16:02

    Imen,

    the question was not *how* to set the same AF to multiple pins in CubeMX.

    The question was, *what happens* if multiple pins are set to the very same AF, in any means.

    JW

    FLast.17.70
    Associate II
    October 23, 2017
    Posted on October 23, 2017 at 16:04

    Hello Imen,

    Yes, I know that some pins have alternative(s) and I can choose between them with <ctrl> click. But when I choose an alternative, the original choice is removed. 

    What I want is to assign the same function to more than one pin.

    I assume this is possible - I suppose at the silicon level there are some multiplexers connected to each pin that route the internal peripheral I/O signal to one pin or another; I can't see any reason why the same internal signal could not be routed to multiple pins. But the ST32CubeMX does not seem to allow me to do this. (Admittedly, probably not many people would want to do this, although who knows...)

    Jeanne Joly
    Associate
    February 8, 2018
    Posted on February 08, 2018 at 17:53

    Hello

    Gaspar.Laszlo

    ,

    Sorry for my late answer.

    I understand your point and confirm that CubeMX does not allow to use a same AF on 2 different pins.

    I think that your point is interested and need to be kept in mind. Can I suggest you to put this idea in

    https://community.st.com/community/stm32-community/stm32-forum/blog/2017/12/19/2018-stm32-wish-list

    ?

    Thanks in advance.

    Jeanne

    FLast.17.70
    Associate II
    February 9, 2018
    Posted on February 09, 2018 at 09:30

    Hello Jeanne,

    Thanks for your e-mail. I have added some comments on the forum.

    Best regards,

    Laszlo

    henry.dick
    Associate II
    February 8, 2018
    Posted on February 08, 2018 at 22:04

    A great question about the chips capability - whether the library supports it is another story. 

    On okder chips with fixed remapping schemes assignig alternate alternate functions to multiple pins is obviously not possible. 

    On newer chips. ......

    FLast.17.70
    Associate II
    February 9, 2018
    Posted on February 09, 2018 at 09:06

    Hello Jeanne,

    Although CubeMX does not allow the same AF to be mapped to two different pins, the processor itself does not have any problem doing it. I can confirm that on the STM32F767 I am using I can output the DFSDM clock simultaneously both on pins PC2 (where it is AF6) and PD3 (where it is AF3). 

    What is the point? - you may ask. The answer is PCB layout.On rare occasions you may want to have the same signal on pins that are on opposite sides of the chip; if your layout is complicated already this will save you having to route a signal across the processor area. 

    (Dhenry - I don't know if the standard peripheral library support this, I don't use it.)

    A side comment: I do like the STM32 processors, but I have to say one thing I find disappointing is the port mapping of peripherals. Functionality is not distributed evenly. There are 'popular pins', available to a large number of peripherals and 'useless pins' that can only be used as GPIO. If you want to make use of a lot of the peripherals (which I guess is what they are there for...) invariably you end up scratching your head how you are going to map the whole lot onto the pins. In that sense the Microchip PIC24F family is a joy to use as they allow almost any peripheral to be mapped to almost any pin (with some notable exceptions). OK, I understand, you need a large multiplexer on the silicon but still... At least some middle ground, please... 

    Jeanne Joly
    Associate
    February 9, 2018
    Posted on February 09, 2018 at 09:54

    Hello

    Gaspar.Laszlo

    ,

    I am very interested in the example you gave with the STM32F767 where you use the DFSDM out for pins PC2 and PD3 (I tried but I can't map the signal DFSDM1_CKOUT to both PC2 and PD3).Can you please send me your ioc file in order that I see what you are talking about.?

    BR. Jeanne

    FLast.17.70
    Associate II
    February 9, 2018
    Posted on February 09, 2018 at 10:11

    Hi Jeanne,

    I can send you the ioc file (see attached) - but I’m a bit confused. The whole point is that STM32CubeMX does not allow you to map DFSDM1_CKOUT to both PC2 and PD3 but the processor can do it.

    So if you want to see it in practice, you would need to see the project source code files – which you can have if you like.

    (Actually I don’t use STM32CubeMX for code generation, it’s only purpose is a “sanity check�?, so that I can catch any mistakes. Neither do I use the STM peripheral libraries, I use my own.)

    Best regards,

    Laszlo

    ________________

    Attachments :

    BBD303 with FPGA.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxuO&d=%2Fa%2F0X0000000b3K%2FBSmztwDx0imfCVy0W0oR9CtezZvreUZRdabNS2.xiSc&asPdf=false