STM32L4 support Topic is solved

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32L4 support

Post by Giovanni »

It looks like a wrong interrupt vector is used, check the registry.

Giovanni
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32L4 support

Post by RoccoMarco »

Can you place a breakpoint in usb_lld_read_setup and check where it hangs?
Set O0 in makefile. Thanks for your time. If you are busy do not worry, I will made a cable in the next days.

Edit: I have found another wrong thing in the registry and this could be the source of the problem
DEHiCKA
Posts: 17
Joined: Thu Feb 21, 2013 8:13 am
Has thanked: 4 times
Been thanked: 3 times

Re: STM32L4 support

Post by DEHiCKA »

Thanks, it works now!
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32L4 support

Post by RoccoMarco »

Thank you for your time.
drakon
Posts: 5
Joined: Tue Mar 08, 2011 9:32 pm

Re: STM32L4 support

Post by drakon »

I am trying to get SPI running on this board. I get following error message during compilation:

main.c:184:42: error: 'PAL_STM32_OSPEED_HIGHEST' undeclared (first use in this function)
PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); /* New SCK */

What could be wrong with it? If I remove PAL_STM32_OSPEED_HIGHEST from my code the compilation is successful.
User avatar
tfAteba
Posts: 551
Joined: Fri Oct 16, 2015 11:03 pm
Has thanked: 91 times
Been thanked: 50 times

Re: STM32L4 support

Post by tfAteba »

Hi Drakon,

Wich version of ChibiOS do you use?

I looked into trunk, and "PAL_STM32_OSPEED_HIGHEST" is define in os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h
.

So if you are using GPIOv1 or GPIOv3", it is normal, that macro is not define there.
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32L4 support

Post by RoccoMarco »

Hi,
STM32L4 uses GPIOv3. Masks are:

Code: Select all

#define PAL_STM32_OSPEED_MASK           (3U << 3U)
#define PAL_STM32_OSPEED_LOW            (0U << 3U)
#define PAL_STM32_OSPEED_MEDIUM         (1U << 3U)
#define PAL_STM32_OSPEED_FAST           (2U << 3U)
#define PAL_STM32_OSPEED_HIGH           (3U << 3U)

Ciao
drakon
Posts: 5
Joined: Tue Mar 08, 2011 9:32 pm

Re: STM32L4 support

Post by drakon »

Thank you! It works.

Another one problem I got now is to get the EXT subsystem running on the stm32L432 board. In the project "testhal/STM32/STM32L4xx/EXT" I changed the port to PC14, but the board doesn’t respond to the changes on that port. Any idea?

Code: Select all

static const EXTConfig extcfg = {
  {
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOC, extcb1},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL},
    {EXT_CH_MODE_DISABLED, NULL}
  }
};


Code: Select all

  while (true) {
    chThdSleepMilliseconds(5000);
    extChannelDisable(&EXTD1, 14);
    chThdSleepMilliseconds(5000);
    extChannelEnable(&EXTD1, 14);
  }
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32L4 support

Post by RoccoMarco »

Note that the EXTI is enabled for half period each 10 second. You should change your code in:

Code: Select all

  extChannelEnable(&EXTD1, 14);
  while (true) {
    chThdSleepMilliseconds(500);
  }


BTW PC14 and PC15 are connected to the external XTAL. It is not a free pin. (I am supposing you are talking about STM32 Nucleo-32 L432)
Ciao
Post Reply