How to create a custom board project?

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

Moderators: RoccoMarco, barthess

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: How to create a custom board project?

Postby Chudik » Thu Nov 03, 2016 9:35 pm

How to define EXTI pin in board.chcfg file?

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: How to create a custom board project?

Postby RoccoMarco » Thu Nov 03, 2016 9:42 pm

Ciao,
Usually it is an input with or without pull resistor.
Ciao,
RM

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: How to create a custom board project?

Postby Chudik » Thu Nov 03, 2016 9:52 pm

I.e. need define as input and assign it to EXTI in code, correct?

I'm trying manually translate all my settings I did in CubeMX reference project, and in that program you define that pin as external interrupt, not as input. Obviously it becomes an input, but not defined so when CubeMX generates the code.

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: How to create a custom board project?

Postby RoccoMarco » Thu Nov 03, 2016 10:01 pm

EXTI driver is able to detect a logic level transition on a certain pin. Set a pin as input then start EXTI with a proper configuration.
In the configuration you have to choose the mode for each exti line and a callback which will be launched on the transition.

As example STM32F3

Code: Select all

static const EXTConfig extcfg = {
  {
    {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, 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}
  }
};


This configuration detects both high to low and low to high transition on EXTI line 0. Note that on exti line 0 there are PA0, PB0, PC0 connected through a multiplexer.

This configuration chooses PA0. Autostarted means that after extStart the driver is already "listening". extcb1 is the pointer to the function which is launched when an edge is detected.

You can found bunches of demos like this under testhal.

By the way, I heard that Giovanni has integrated ext in pal. I am currently out of date about this. Anyway, EXT APIs are still supported.
Ciao.
Ciao,
RM

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: How to create a custom board project?

Postby Chudik » Thu Nov 03, 2016 10:09 pm

Note that on exti line 0 there are PA0, PB0, PC0 connected through a multiplexer.

Yes, I know that :)

I'm going to use PD2 for EXTI2.

I heard that Giovanni has integrated ext in pal

Hmm, that would be interesting.

Thanks

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: How to create a custom board project?

Postby Chudik » Wed Nov 16, 2016 3:50 am

Project compilation after creating the custom board gives errors

Code: Select all

Description   Resource   Path   Location   Type
Field 'p_newer' could not be resolved   chsys.c   /FW-0134_CHM3/os/os/rt/src   line 276   Semantic Error
Field 'p_next' could not be resolved   chsys.c   /FW-0134_CHM3/os/os/rt/src   line 223   Semantic Error
Field 'p_next' could not be resolved   chsys.c   /FW-0134_CHM3/os/os/rt/src   line 226   Semantic Error
Field 'p_older' could not be resolved   chsys.c   /FW-0134_CHM3/os/os/rt/src   line 283   Semantic Error
Field 'p_prev' could not be resolved   chsys.c   /FW-0134_CHM3/os/os/rt/src   line 230   Semantic Error
Field 'p_prev' could not be resolved   chsys.c   /FW-0134_CHM3/os/os/rt/src   line 233   Semantic Error
Field 'p_state' could not be resolved   chsys.c   /FW-0134_CHM3/os/os/rt/src   line 125   Semantic Error


With Nucleo board I had no such problem.
What could it be? Which way to dig?

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: How to create a custom board project?

Postby Giovanni » Wed Nov 16, 2016 9:58 am

Probably you are mixing RT3 and RT4 stuff, in RT4 field names lost the p_ prefix.

Giovanni

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: How to create a custom board project?

Postby Chudik » Wed Nov 16, 2016 2:15 pm

I don't know what is RT3 anв RT4 :roll: How to check it?
I just transfered my project from Nucleo to custom board keeping all environment as same as possible. Different pinout and set of interfaces, of course.

Eith Nucleo board RT + shell worked ok and I decided to transfer it to the custom board at this step, before adding all the other stuff.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: How to create a custom board project?

Postby Giovanni » Wed Nov 16, 2016 5:04 pm

ChibiOS/RT 3.x and ChibiOS/RT 4.x.

3.x is in the stable 16.1.x version, RT4 is the version in trunk.

Giovanni

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: How to create a custom board project?

Postby Chudik » Wed Nov 16, 2016 7:00 pm

I did not download RT4.
I'm using the same set of files for chibios 1.61 located at the same place under Chiibistudio. I even had to create directory in the same place as all the other boards located (usually I try to not change "parent" set of files and directories), otherwise it lost some paths


Return to “STM32 Support”

Who is online

Users browsing this forum: Google [Bot] and 42 guests