Page 2 of 3

Re: How to create a custom board project?

Posted: Thu Nov 03, 2016 9:35 pm
by Chudik
How to define EXTI pin in board.chcfg file?

Re: How to create a custom board project?

Posted: Thu Nov 03, 2016 9:42 pm
by RoccoMarco
Ciao,
Usually it is an input with or without pull resistor.

Re: How to create a custom board project?

Posted: Thu Nov 03, 2016 9:52 pm
by Chudik
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.

Re: How to create a custom board project?

Posted: Thu Nov 03, 2016 10:01 pm
by RoccoMarco
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.

Re: How to create a custom board project?

Posted: Thu Nov 03, 2016 10:09 pm
by Chudik
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

Re: How to create a custom board project?

Posted: Wed Nov 16, 2016 3:50 am
by Chudik
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?

Re: How to create a custom board project?

Posted: Wed Nov 16, 2016 9:58 am
by Giovanni
Probably you are mixing RT3 and RT4 stuff, in RT4 field names lost the p_ prefix.

Giovanni

Re: How to create a custom board project?

Posted: Wed Nov 16, 2016 2:15 pm
by Chudik
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.

Re: How to create a custom board project?

Posted: Wed Nov 16, 2016 5:04 pm
by Giovanni
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

Re: How to create a custom board project?

Posted: Wed Nov 16, 2016 7:00 pm
by Chudik
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