Page 1 of 1

Nucleo-144 stm32F767zi

Posted: Thu Nov 12, 2020 3:51 pm
by jacob-rf
Arduino_Core_STM32 works great for the Nucleo-144 STMF767 board.
But portF pin 11 is not accessible in the code.
Same for Port E pin 1.

Following Cmd will not compile:
1: pinMode(PF11, OUTPUT); //works on all routed pins. but not PF11
2: GPIOF->CRH = 0x33333333; //works on maple boards
3: PORTF->CRH = 0x33333333; //Wont work
4: PORTA->regs->CRH = 0x33333333;; //wont work

Guess it is a bug

BR

Re: stm32F767 Generic use

Posted: Thu Nov 12, 2020 4:35 pm
by mlundin
The STM32F7xx processors doesnt have a CRH register. Pin mode is set using the MODER register, and eventually for alternate functions the AFRL and AFRH registers ( sometimes coded as AFR[0] and AFR[1] ) .
Read the GPIO section in the reference manual for the relevant GPIO registers.

So setting PF11 to output mode would be, 2 bits per pin and output is mode 1

Code: Select all

GPIOF->MODER &= ~0x00C00000; // clear mode for pin 11
GPIOF->MODER |=  0x00400000; // set pin 11 to mode 1

Re: stm32F767 Generic use

Posted: Thu Nov 12, 2020 4:46 pm
by fpiSTM
jacob-rf wrote: Thu Nov 12, 2020 3:51 pm
Following Cmd will not compile:
1: pinMode(PF11, OUTPUT); //works on all routed pins. but not PF11

Guess it is a bug
This is not a bug. PF11 is simply not defined in the variant.

Re: Nucleo-144 stm32F767zi

Posted: Thu Nov 12, 2020 9:16 pm
by jacob-rf
fpiSTM: Why should it not be defined on purpose? I would like to use it..

mlundin: Thanks for the help it works now. I needed to add port speed and enable the clk for the port too.

Code: Select all

RCC->AHB1ENR |= RCC_AHB1ENR_GPIOFEN;//peripheral clock enable for PortF
GPIOF->MODER |=  0x00400000; // set pin 11 to mode 1
GPIOF->OSPEEDR |=  0x00C00000; //set pin 11 to high speed

Re: Nucleo-144 stm32F767zi

Posted: Fri Nov 13, 2020 8:19 am
by fpiSTM
jacob-rf wrote: Thu Nov 12, 2020 9:16 pm fpiSTM: Why should it not be defined on purpose? I would like to use it..
Well, the variant has been made by a contributor:
https://github.com/stm32duino/Arduino_C ... 2/pull/300

I've only review and made some clean up.

I know several variant does not have all pins defined, I'm currently working on a rework to ease generic variant addition and provide access to all pins.
This will be fixed thanks my rework. But as said this is not a bug as variant can be defined as you want. ;)