Report
1 year, 3 months ago.

PortIn in NUCLEO?

How to map PortIn method pins on NUCLEO 411re?

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F411RET6 microcontroller.

Answer found: referring to a pinout with hardware port names is enough for building a bitmask. I will use an 8-bit port for the OV7670 parallel camera; I'll take pins on Port C to grab the incoming byte: MSB LSB D7,D6,D5,D4,D3,D2,D1,D0 -> PC12,PC13,PC14,PC15,PC2,PC3,PC1,PC0 (This is an arbitrary assignment of the pins! I referred to https://jpralves.net/img/mcb/nucleo_pinout_13.png) Basically the Pin number is coded in the POSITION of a "1" in the bitmask applied to the port: if I want to read just one pin of the port, say PC0, I'll write: data(Port C,0x1); If I want PC0, PC2 and PC13 it' ll become data(Port C,0x0x2005); And the pin values will be stored in "data". Obviously I will have to shift the bits around to make the whole byte.

posted by angelo mottolese 04 Oct 2017
Comment on this question
Be the first to answer this question.

To post an answer, please log in.