Page 1 of 2

STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 2:52 pm
by sntnjrg
Hi,

In the manual of the STM32L4R5ZI-NUCLEO144 board it is mentioned that there are 4 I2C buses but in the mcuconf.h file (https://github.com/ChibiOS/ChibiOS/blob/master/demos/STM32/RT-STM32L4R5ZI-NUCLEO144/cfg/mcuconf.h) appears:

Code: Select all

/*
 * I2C driver system settings.
 */
#define STM32_I2C_USE_I2C1                  TRUE
#define STM32_I2C_USE_I2C2                  TRUE
#define STM32_I2C_USE_I2C3                  FALSE
#define STM32_I2C_BUSY_TIMEOUT              50
#define STM32_I2C_I2C1_RX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C1_TX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C2_RX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C2_TX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C3_RX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C3_TX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C1_IRQ_PRIORITY         5
#define STM32_I2C_I2C2_IRQ_PRIORITY         5
#define STM32_I2C_I2C3_IRQ_PRIORITY         5
#define STM32_I2C_I2C1_DMA_PRIORITY         3
#define STM32_I2C_I2C2_DMA_PRIORITY         3
#define STM32_I2C_I2C3_DMA_PRIORITY         3
#define STM32_I2C_DMA_ERROR_HOOK(i2cp)      osalSysHalt("DMA failure")


To use bus 4, do I only have to add new macros (STM32_I2C_USE_I2C4, STM32_I2C_I2C4_RX_DMA_STREAM, ...)?

Thanks you.

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 3:15 pm
by Giovanni
Hi,

It should work, not tested.

Giovanni

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 3:16 pm
by FXCoder
Hi.
You have it pretty much.
Below is an I2C setup from a working L4+ project...
--
Bob

Code: Select all

/*
 * I2C driver system settings.
 */
#define STM32_I2C_USE_I2C1                  TRUE
#define STM32_I2C_USE_I2C2                  FALSE
#define STM32_I2C_USE_I2C3                  TRUE
#define STM32_I2C_USE_I2C4                  TRUE
#define STM32_I2C_BUSY_TIMEOUT              50
#define STM32_I2C_I2C1_RX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C1_TX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C2_RX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C2_TX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C3_RX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C3_TX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C4_RX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C4_TX_DMA_STREAM        STM32_DMA_STREAM_ID_ANY
#define STM32_I2C_I2C1_IRQ_PRIORITY         5
#define STM32_I2C_I2C2_IRQ_PRIORITY         5
#define STM32_I2C_I2C3_IRQ_PRIORITY         5
#define STM32_I2C_I2C4_IRQ_PRIORITY         5
#define STM32_I2C_I2C1_DMA_PRIORITY         3
#define STM32_I2C_I2C2_DMA_PRIORITY         3
#define STM32_I2C_I2C3_DMA_PRIORITY         3
#define STM32_I2C_I2C4_DMA_PRIORITY         3
#define STM32_I2C_USE_DMA                   FALSE
#define STM32_I2C_DMA_ERROR_HOOK(i2cp)      osalSysHalt("DMA failure")

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 3:17 pm
by Giovanni
If it works then it is a bug, mcuconf.h should be updated.

Giovanni

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 3:26 pm
by FXCoder
A bug? Not sure why...

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 3:41 pm
by Giovanni
It would be a bug because mcuconf files should already have those definitions if the driver supports it.

Giovanni

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 3:56 pm
by FXCoder
OK. Understand now what you meant.
The I2C4 driver did have a bug but that was fixed a while back.
—
Bob

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 4:39 pm
by sntnjrg
Hi,

I have added the macros for the I2C bus 4 but when compiling I get the following errors:

Code: Select all

Compiling hal_serial.c
In file included from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal_i2c.h:85,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal.h:140,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/src/hal_serial.c:25:
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:306:2: error: #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
  ^~~~~
In file included from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal_i2c.h:85,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal.h:140,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/src/hal_st.c:25:
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:306:2: error: #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:310:2: error: #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
/workspace/ChibiStudio/chibios_stable-19.1.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:177: fallo en las instrucciones para el objetivo 'build/obj/hal_mmcsd.o'
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:6: warning: "STM32_BDMA_IS_VALID_PRIORITY" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:34: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
                                  ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:447:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:464:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
In file included from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal_i2c.h:85,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal.h:140,
/workspace/ChibiStudio/chibios_stable-19.1.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:177: fallo en las instrucciones para el objetivo 'build/obj/hal.o'
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/src/hal_mmcsd.c:25:
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:306:2: error: #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:310:2: error: #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:6: warning: "STM32_BDMA_IS_VALID_PRIORITY" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:34: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
                                  ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:447:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:464:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
In file included from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal_i2c.h:85,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal.h:140,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/src/hal.c:25:
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:306:2: error: #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:310:2: error: #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
/workspace/ChibiStudio/chibios_stable-19.1.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:177: fallo en las instrucciones para el objetivo 'build/obj/hal_st.o'
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:6: warning: "STM32_BDMA_IS_VALID_PRIORITY" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:34: error: missing binary operator before token "("
/workspace/ChibiStudio/chibios_stable-19.1.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:177: fallo en las instrucciones para el objetivo 'build/obj/hal_serial.o'
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
                                  ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:447:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:464:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:310:2: error: #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
/workspace/ChibiStudio/chibios_stable-19.1.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:177: fallo en las instrucciones para el objetivo 'build/obj/hal_queues.o'
 #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:6: warning: "STM32_BDMA_IS_VALID_PRIORITY" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:34: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
                                  ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:447:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:464:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
make: *** [build/obj/hal_mmcsd.o] Error 1
make: *** Se espera a que terminen otras tareas....
In file included from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal_i2c.h:85,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal.h:140,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/src/hal_queues.c:40:
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:306:2: error: #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:310:2: error: #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:32: error: missing binary operator before token "("
/workspace/ChibiStudio/chibios_stable-19.1.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:177: fallo en las instrucciones para el objetivo 'build/obj/hal_pal.o'
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
/workspace/ChibiStudio/chibios_stable-19.1.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:177: fallo en las instrucciones para el objetivo 'build/obj/hal_i2c.o'
/workspace/ChibiStudio/chibios_stable-19.1.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:177: fallo en las instrucciones para el objetivo 'build/obj/hal_buffers.o'
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:6: warning: "STM32_BDMA_IS_VALID_PRIORITY" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:34: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
                                  ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:447:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:464:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
make: *** [build/obj/hal.o] Error 1
In file included from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal_i2c.h:85,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal.h:140,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/src/hal_pal.c:25:
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:306:2: error: #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:310:2: error: #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:6: warning: "STM32_BDMA_IS_VALID_PRIORITY" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:34: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
                                  ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:447:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:464:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
make: *** [build/obj/hal_st.o] Error 1
In file included from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal_i2c.h:85,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal.h:140,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/src/hal_i2c.c:28:
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:306:2: error: #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:310:2: error: #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:6: warning: "STM32_BDMA_IS_VALID_PRIORITY" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:34: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
                                  ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:447:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:464:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
In file included from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal_i2c.h:85,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/include/hal.h:140,
                 from /workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/src/hal_buffers.c:41:
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:306:2: error: #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_RX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:310:2: error: #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
 #error "STM32_I2C_I2C4_TX_BDMA_STREAM not defined"
  ^~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:313:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_RX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:6: warning: "STM32_BDMA_IS_VALID_STREAM" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:317:32: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_STREAM(STM32_I2C_I2C4_TX_BDMA_STREAM)
                                ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:6: warning: "STM32_BDMA_IS_VALID_PRIORITY" is not defined, evaluates to 0 [-Wundef]
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:321:34: error: missing binary operator before token "("
 #if !STM32_BDMA_IS_VALID_PRIORITY(STM32_I2C_I2C4_DMA_PRIORITY)
                                  ^
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:447:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-19.1.x/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h:464:11: error: unknown type name 'stm32_bdma_stream_t'
     const stm32_bdma_stream_t  *bdma;
           ^~~~~~~~~~~~~~~~~~~


Thanks for the help

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Mon Aug 24, 2020 5:13 pm
by Giovanni
Hi,

I see you are using 19.1.x, the support is only present in 20.3.x.

Giovanni

Re: STM32L4R5ZI-NUCLEO144: How to activate the I2C4 bus on mcuconf.h?

Posted: Wed Aug 26, 2020 8:26 am
by sntnjrg
Hi Giovanni,

I cloned the master branch from Github repository. Last commit in the repository was: Simplified USART units use collision detection in STM32 HAL, now it is done like for TIM units for consistency (commit 5fec2a17fcdcc8b430c31243378a8b9aae10f899).

I updated the cfg folder with the files of this project: https://github.com/ChibiOS/ChibiOS/tree/master/demos/STM32/RT-STM32L4R5ZI-NUCLEO144

When I compile my project, I have the following errors:

Code: Select all

/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/src/chsys.c: In function 'chSysInit':
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/src/chsys.c:93:8: error: 'os_instance_config_t' {aka 'const struct ch_os_instance_config'} has no member named 'mainthread_base'; did you mean 'idlethread_base'?
       .mainthread_base  = &__main_thread_stack_base__,
        ^~~~~~~~~~~~~~~
        idlethread_base
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/src/chsys.c:94:8: error: 'os_instance_config_t' {aka 'const struct ch_os_instance_config'} has no member named 'mainthread_end'; did you mean 'idlethread_end'?
       .mainthread_end   = &__main_thread_stack_end__,
        ^~~~~~~~~~~~~~
        idlethread_end
In file included from /workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/include/ch.h:111,
                 from /workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/src/chsys.c:36:
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/include/chthreads.h:142:34: warning: initialized field overwritten [-Woverride-init]
 #define THD_WORKING_AREA_BASE(s) ((stkalign_t *)(s))
                                  ^
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/src/chsys.c:96:27: note: in expansion of macro 'THD_WORKING_AREA_BASE'
       .idlethread_base  = THD_WORKING_AREA_BASE(ch_idle_thread_wa),
/workspace/ChibiStudio/chibios_stable-20.3.x/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:186: fallo en las instrucciones para el objetivo 'build/obj/chsys.o'
                           ^~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/include/chthreads.h:142:34: note: (near initialization for 'default_cfg.idlethread_base')
 #define THD_WORKING_AREA_BASE(s) ((stkalign_t *)(s))
                                  ^
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/src/chsys.c:96:27: note: in expansion of macro 'THD_WORKING_AREA_BASE'
       .idlethread_base  = THD_WORKING_AREA_BASE(ch_idle_thread_wa),
                           ^~~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/include/chthreads.h:149:33: warning: initialized field overwritten [-Woverride-init]
 #define THD_WORKING_AREA_END(s) (THD_WORKING_AREA_BASE(s) +                 \
                                 ^
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/src/chsys.c:97:27: note: in expansion of macro 'THD_WORKING_AREA_END'
       .idlethread_end   = THD_WORKING_AREA_END(ch_idle_thread_wa)
                           ^~~~~~~~~~~~~~~~~~~~
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/include/chthreads.h:149:33: note: (near initialization for 'default_cfg.idlethread_end')
 #define THD_WORKING_AREA_END(s) (THD_WORKING_AREA_BASE(s) +                 \
                                 ^
/workspace/ChibiStudio/chibios_stable-20.3.x/os/rt/src/chsys.c:97:27: note: in expansion of macro 'THD_WORKING_AREA_END'
       .idlethread_end   = THD_WORKING_AREA_END(ch_idle_thread_wa)
                           ^~~~~~~~~~~~~~~~~~~~
make: *** [build/obj/chsys.o] Error 1
make: *** Se espera a que terminen otras tareas....
"make -j8 all" terminated with exit code 2. Build might be incomplete.


How can I solve this problem?

Thank you for the help.