PORT_G undeclared (first use in this function, HAL, pal_lld.h

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Post Reply
ngm
Posts: 4
Joined: Sat Apr 01, 2017 9:42 am
Has thanked: 3 times

PORT_G undeclared (first use in this function, HAL, pal_lld.h

Post 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);
}
User avatar
tfAteba
Posts: 551
Joined: Fri Oct 16, 2015 11:03 pm
Has thanked: 91 times
Been thanked: 50 times

Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h

Post 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.
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h

Post 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)
ngm
Posts: 4
Joined: Sat Apr 01, 2017 9:42 am
Has thanked: 3 times

Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h

Post 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
ngm
Posts: 4
Joined: Sat Apr 01, 2017 9:42 am
Has thanked: 3 times

Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h

Post 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
User avatar
tfAteba
Posts: 551
Joined: Fri Oct 16, 2015 11:03 pm
Has thanked: 91 times
Been thanked: 50 times

Re: PORT_G undeclared (first use in this function, HAL, pal_lld.h

Post 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.
Post Reply