1
\$\begingroup\$

I want to use an Arduino TFT shield (ILI9341) on a Nucleo STM32L476 developement board. This shield use 8 bits MCU mode and work well but the pin implantation for the Arduino connector on the Nucleo is not very convenient.

NUCLEO STM32L476RG pins ILI9341 Arduino shield pins

The data bus pins mapping is actually :

TFT    |  7  |   6  |  5  |  4  |  3  |   2  |  1  |  0  |
NUCLEO | PA8 | PB10 | PB4 | PB5 | PB3 | PA10 | PC7 | PA9 |

To write a byte on TFT bus i need to do a lot of shifting, masking, etc ... This produce an overhead on the TFT communication bandwidth.

Is there a way on the STM32L4 to remap the GPIOs and PORTs into a sort of "virtual parallel port" where, after configuration, i can just write my byte on a register and the the hardware wire this register into the specified GPIOs/PORTs ?

\$\endgroup\$
7
  • \$\begingroup\$ Where do you get this mapping from? \$\endgroup\$
    – DiBosco
    Commented Nov 30, 2017 at 13:25
  • 1
    \$\begingroup\$ @DiBosco I get it from TFT pcb and Nucleo pins description in ST datasheet, i edit to add images. \$\endgroup\$
    – rom1nux
    Commented Nov 30, 2017 at 13:41
  • \$\begingroup\$ I'm unsure of the differences between the D0-D15 in the green boxes and the labels just to the right in the blue boxes of the top image. Do you know what's going on with that? \$\endgroup\$
    – DiBosco
    Commented Nov 30, 2017 at 13:59
  • 1
    \$\begingroup\$ Hmmm, that pinout, having found the Nucleo manual, does seem staggeringly inconvenient. I really don't understand their labeling D0-D15. It feels like we must be missing something here. If this was me doing this, I would be making a little adapter board to connect up the LCD D0-D7 to PA0-8 and connecting the rest to the appropriate pins. It would take a bit of working out, but make your software a damn site easier! \$\endgroup\$
    – DiBosco
    Commented Nov 30, 2017 at 14:22
  • \$\begingroup\$ @DiBosco the D0 to D15 is the Arduino connector name for that pin. \$\endgroup\$
    – Arsenal
    Commented Nov 30, 2017 at 14:30

1 Answer 1

1
\$\begingroup\$

You are correct in your analysis, that it is an inkonvenient layout for a parallel bus.

Another version of your pinout graphic: pinout of Nucleo-L476RG

Taken from the reference manual.

Sadly, there is no way to remap internal pins to external pins. The STM32 is very restrictive in that regard (also in regard to alternate functions of the pins).


EDIT: Scrap this part for the GPIO:

The only thing which comes to my mind (without changing the hardware) which might speed up your process is the memory mapped bit banding access to single bits of the corresponding register by a single write to a word address.

To see this in more detail have a look at the reference manual of the L476 section 2.3 about bit banding.

I haven't used it so far, so I can't comment on the usefulness of it. But getting the right word addresses for each of the needed pin bits in the ODR register might speed up the work.


Reason why to scrap the idea with bit banding:

Looking further into the bit banding in the L476, the programming manual reveals that only the region from 0x40000000 to 0x400FFFFF is accessible. The GPIO registers start at 0x48000000 so they are outside of the bit banding region.


So the only option to really simplify your software is to wire the board differently.

\$\endgroup\$
8
  • \$\begingroup\$ I come to Arduino shield to save my time... but here i think i'm going to return to my perfboard. Now i know... Thanks for your response. \$\endgroup\$
    – rom1nux
    Commented Nov 30, 2017 at 15:41
  • \$\begingroup\$ "there is no way to remap internal pins to external pins". i was curious if that is possible on arduino? \$\endgroup\$
    – vikrant
    Commented Jun 7, 2020 at 19:24
  • \$\begingroup\$ @vikrant I'm not familiar with the microcontrollers used on arduinos, so I can't tell. Microcontrollers with very flexible GPIO structures exist. You could ask that on arduino stack exchange. \$\endgroup\$
    – Arsenal
    Commented Jun 8, 2020 at 8:56
  • \$\begingroup\$ @Arsenal I think on Arduino you can assign any pin as input or output. Is this the same thing you are talking about? \$\endgroup\$
    – vikrant
    Commented Jun 8, 2020 at 8:59
  • \$\begingroup\$ @vikrant no, switching a pin between different functions is always possible if we have a GPIO (general purpose input output), but mapping the Pin 36 on the housing to GPIO A12 or B8 is not possible in the STM32 but can be possible in other MCUs. \$\endgroup\$
    – Arsenal
    Commented Jun 8, 2020 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.