Page 1 of 2

ADC configuration tool

Posted: Wed May 13, 2020 11:03 am
by ceremcem
I'm having hard times while finding my way along with the ADC parameters. Being have to remember all the tiny parameters is uncool IMHO. Is there any configuration tool for that purpose?

If not, I'm planning to create a Web UI with dropdowns and such, that will generate the desired ADCConversionGroup struct. User will only copy and paste the resulting struct into the code.

I'm opening this thread in order to prevent a duplicate work if it already exists.

Re: ADC configuration tool

Posted: Wed May 13, 2020 12:05 pm
by Giovanni
Hi,

A while ago I started making an ADC configuration generator but then there are always more urgent things to do.

What it is done is a prototype of generator template written in FreeMarker; ./tools/ftl/libs/libstm32f4xx.ftl

I have no immediate plans to resume this thing.

Giovanni

Re: ADC configuration tool

Posted: Wed May 13, 2020 12:15 pm
by ceremcem
Very nice to hear that! So this is a real necessity and this approach is accurate. Thanks for the fast response.

Re: ADC configuration tool

Posted: Sun Aug 23, 2020 10:14 pm
by ceremcem
Hi Giovanni,

I made something that barely states my intention: https://aktos.io/chibi-config/ (source code here).

I need some sort of assistance, if you could. The .c and .h files are actually Ractive templates and I'm basically generating .c and .h files from those templates by user supplied pin configuration data (from web interface). I'm obtaining the available MCU types from CubeMX's XML database, which currently has 1162 defined MCU types.

I'm confused about how to match the MCU definitions in board.h by the user supplied MCU type (one of those).

I thought I could automatically match with file names in $CHIBIOS/os/common/ext/ST/ but it contains some unpredictable files (such as system_stm32l0xx.h).

How should I obtain the list of available ChibiOS MCU family types without parsing the whole .h files under os/common/ext/ST/?

Re: ADC configuration tool

Posted: Mon Aug 24, 2020 7:34 am
by Giovanni
Hi,

There is an XML here: \tools\ftl\processors\processors.xml

However it only lists MCUs supported by the board files generator.

Giovanni

Re: ADC configuration tool

Posted: Mon Aug 24, 2020 8:23 am
by ceremcem
Giovanni wrote:Hi,

There is an XML here: \tools\ftl\processors\processors.xml

However it only lists MCUs supported by the board files generator.


It only lists a few, not useful for the purpose.

May I depend on extracting the definitions from os/common/ext/ST/**/*xx.h files? I can parse and extract the definitions from

Code: Select all

...if defined(STMxxx)

lines by the following Bash code:

Code: Select all

find os/common/ext/ST/ -type f -iname "*xx.h*" -print0 \
    | xargs -0 egrep "if defined\(STM.*\)" \
    | sed -r 's/.*\((.*)\)/\1/g'


Here is the generated list:

Code: Select all

STM32F030x6
STM32F030x8
STM32F031x6
STM32F038xx
STM32F042x6
STM32F048xx
STM32F051x8
STM32F058xx
STM32F070x6
STM32F070xB
STM32F071xB
STM32F072xB
STM32F078xx
STM32F091xC
STM32F098xx
STM32F030xC
STM32F100xB
STM32F100xE
STM32F101x6
STM32F101xB
STM32F101xE
STM32F101xG
STM32F102x6
STM32F102xB
STM32F103x6
STM32F103xB
STM32F103xE
STM32F103xG
STM32F105xC
STM32F107xC
STM32F205xx
STM32F215xx
STM32F207xx
STM32F217xx
STM32F301x8
STM32F302x8
STM32F302xC
STM32F302xE
STM32F303x8
STM32F303xC
STM32F303xE
STM32F373xC
STM32F334x8
STM32F318xx
STM32F328xx
STM32F358xx
STM32F378xx
STM32F398xx
STM32F405xx
STM32F415xx
STM32F407xx
STM32F417xx
STM32F427xx
STM32F437xx
STM32F429xx
STM32F439xx
STM32F401xC
STM32F401xE
STM32F410Tx
STM32F410Cx
STM32F410Rx
STM32F411xE
STM32F446xx
STM32F469xx
STM32F479xx
STM32F412Cx
STM32F412Zx
STM32F412Rx
STM32F412Vx
STM32F413xx
STM32F423xx
STM32F722xx
STM32F723xx
STM32F732xx
STM32F733xx
STM32F756xx
STM32F746xx
STM32F745xx
STM32F765xx
STM32F767xx
STM32F769xx
STM32F777xx
STM32F779xx
STM32H743xx
STM32H753xx
STM32L011xx
STM32L021xx
STM32L031xx
STM32L041xx
STM32L051xx
STM32L052xx
STM32L053xx
STM32L062xx
STM32L063xx
STM32L061xx
STM32L071xx
STM32L072xx
STM32L073xx
STM32L082xx
STM32L083xx
STM32L081xx
STM32L100xB
STM32L100xBA
STM32L100xC
STM32L151xB
STM32L151xBA
STM32L151xC
STM32L151xCA
STM32L151xD
STM32L151xDX
STM32L151xE
STM32L152xB
STM32L152xBA
STM32L152xC
STM32L152xCA
STM32L152xD
STM32L152xDX
STM32L152xE
STM32L162xC
STM32L162xCA
STM32L162xD
STM32L162xDX
STM32L162xE
STM32L431xx
STM32L432xx
STM32L433xx
STM32L442xx
STM32L443xx
STM32L451xx
STM32L452xx
STM32L462xx
STM32L471xx
STM32L475xx
STM32L476xx
STM32L485xx
STM32L486xx
STM32L496xx
STM32L4A6xx
STM32L4R5xx
STM32L4R7xx
STM32L4R9xx
STM32L4S5xx
STM32L4S7xx
STM32L4S9xx


Is this approach appropriate?

Re: ADC configuration tool

Posted: Mon Aug 24, 2020 8:42 am
by Giovanni
Not all devices are necessarily supported even if the header is there. There is no "official" interface to get supported devices.

Giovanni

Re: ADC configuration tool

Posted: Mon Aug 24, 2020 1:00 pm
by ceremcem
Demos lead a little:

Code: Select all

$ grep -i "MCU type, supported types" os/hal/boards/ -R
os/hal/boards/MAPLEMINI_STM32_F103/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/OLIMEX_STM32_103STK/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/OLIMEX_STM32_H103/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/OLIMEX_STM32_LCD/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/OLIMEX_STM32_P103/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/OLIMEX_STM32_P107/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/STM32F103C8_MINIMAL/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/ST_EVALKITST7580_1/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/ST_INEMO_M1_DISCOVERY/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/ST_NUCLEO64_F103RB/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/ST_STM3210C_EVAL/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/ST_STM3210E_EVAL/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/ST_STM32VL_DISCOVERY/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
os/hal/boards/GOLDBULL_STM32_F107VC/board.h: * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.



Although there is no ./os/hal/platforms/hal_lld.h file in ChibiOS tree, there are various hal_lld.h files:

Code: Select all

$ find -name hal_lld.h
./os/hal/ports/LPC/LPC214x/hal_lld.h
./os/hal/ports/STM32/STM32F0xx/hal_lld.h
./os/hal/ports/STM32/STM32F1xx/hal_lld.h
./os/hal/ports/STM32/STM32F37x/hal_lld.h
./os/hal/ports/STM32/STM32F3xx/hal_lld.h
./os/hal/ports/STM32/STM32F4xx/hal_lld.h
./os/hal/ports/STM32/STM32F7xx/hal_lld.h
./os/hal/ports/STM32/STM32L0xx/hal_lld.h
./os/hal/ports/STM32/STM32L1xx/hal_lld.h
./os/hal/ports/STM32/STM32L4xx/hal_lld.h
./os/hal/ports/STM32/STM32H7xx/hal_lld.h
./os/hal/ports/simulator/posix/hal_lld.h
./os/hal/ports/simulator/win32/hal_lld.h
./os/hal/ports/AVR/MEGA/ATMEGAxx/hal_lld.h
./os/hal/ports/AVR/TINY/ATTinyxxx/hal_lld.h
./os/hal/ports/AVR/XMEGA/ATXMEGAxxxA4U/hal_lld.h
./os/hal/ports/SPC5/SPC560BCxx/hal_lld.h
./os/hal/ports/SPC5/SPC560Bxx/hal_lld.h
./os/hal/ports/SPC5/SPC560Dxx/hal_lld.h
./os/hal/ports/SPC5/SPC560Pxx/hal_lld.h
./os/hal/ports/SPC5/SPC563Mxx/hal_lld.h
./os/hal/ports/SPC5/SPC564Axx/hal_lld.h
./os/hal/ports/SPC5/SPC56ECxx/hal_lld.h
./os/hal/ports/SPC5/SPC56ELxx/hal_lld.h
./os/hal/templates/hal_lld.h


In every hal_lld.h file, here is a useful comment for the purpose, such as:

Code: Select all

/**
 * @file    STM32F0xx/hal_lld.h
 * @brief   STM32F0xx HAL subsystem low level driver header.
 * @pre     This module requires the following macros to be defined in the
 *          @p board.h file:
 *          - STM32_LSECLK.
 *          - STM32_LSEDRV.
 *          - STM32_LSE_BYPASS (optionally).
 *          - STM32_HSECLK.
 *          - STM32_HSE_BYPASS (optionally).
 *          .
 *          One of the following macros must also be defined:
 *          - STM32F030x4, STM32F030x6, STM32F030x8, STM32F030xC,
 *            STM32F070x6, STM32F070xB for Value Line devices.
 *          - STM32F031x6, STM32F051x8, STM32F071xB, STM32F091xC
 *            for Access Line devices.
 *          - STM32F042x6, STM32F072xB for USB Line devices.
 *          - STM32F038xx, STM32F048xx, STM32F058xx, STM32F078xx,
 *            STM32F098xx for Low Voltage Line devices.
 *          .


Should I parse those files? Would the syntax change in comments?

Re: ADC configuration tool

Posted: Mon Aug 24, 2020 2:16 pm
by Giovanni
You could but don't trust those to be updated, the format would not change anyway, that is Doxygen.

Giovanni

Re: ADC configuration tool

Posted: Mon Aug 24, 2020 2:38 pm
by ceremcem
Okay. Give me something then? There should be a way to obtain that list, right?

To be clear, I'm trying to create a configuration tool for ChibiOS. It's much easier to support only MCU's that I personally use. That would prevent all the trouble.

I'm okay with what I'm asking is a paid service, but this should be clearly stated. Of course, you might be busy with some other thing and that's also something understandable. Except those, please lead me to a solution. If there isn't any, let's figure something out?