Page 1 of 1
PORT_G undeclared (first use in this function, HAL, pal_lld.h
Posted: Tue May 02, 2017 2:06 pm
by ngm
Why am I getting the above error? I have included the "pal_lld.h" header file. Here is a snippet of my code. The PAL driver is ticked on.
#include "pal_lld.h"
void set_pin(bool state){
state ? pal_lld_setpad(PORT_G, 1) : pal_lld_clearpad(PORT_G, 1);
}
Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h
Posted: Tue May 02, 2017 10:19 pm
by tfAteba
Hi mng,
It is the first time that I see this notation:
PORT_G
I think, you must use
GPIOG instead of PORT_G.
You can have a look at the demo for the Nucleo f401re board.
It is under:
trunk/demos/STM32/RT-STM32F401RE-NUCLEO64 if you are using trunk for example.
Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h
Posted: Tue May 02, 2017 10:30 pm
by RoccoMarco
Hi,
take a look to default demo. You have to include hal.h only and enable pal driver in halconf.h
Note that with STM32 the ports are usually named as GPIOx where x is the port identifier (A, B, C, D, and so on)
Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h
Posted: Fri May 05, 2017 10:05 am
by ngm
Thanks Rocco. You are right about hal.h. I managed to figure it out. The macro "PORT_G" is correct. I just had to add hal.h instead of pal_lld.h
LG
ngm
Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h
Posted: Fri May 05, 2017 10:07 am
by ngm
tfAteba wrote:Hi mng,
It is the first time that I see this notation:
PORT_G
I think, you must use
GPIOG instead of PORT_G.
You can have a look at the demo for the Nucleo f401re board.
It is under:
trunk/demos/STM32/RT-STM32F401RE-NUCLEO64 if you are using trunk for example.
The macro was right. I just had to add the header file hal.h not pal_lld.h
Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h
Posted: Fri May 05, 2017 10:21 pm
by tfAteba
Hi ngm!
About you macro, (PORT_G) it was the first time that I saw it.
I think that it is must be the original name of the port of a GPIO for your hardware.
So Just for my information can you tell me the name of your target board? and the version of chibios that you are using?
GPIOG must also work, it is may be an alias of your macro.
rocco wrote:
Note that with STM32 the ports are usually named as GPIOx where x is the port identifier (A, B, C, D, and so on)
It confirm what I said.
Did you test this macro?
Any way, thank you for your feed back and I m glad that you resolved you problem

that is the most important.