I have added to the file micropython/ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.h the lines:
Code: Select all
//CAN (added)
#define MICROPY_HW_CAN1_TX (pin_B9)
#define MICROPY_HW_CAN1_RX (pin_B8)
Code: Select all
arm-none-eabi-gcc -I. -I../.. -Ibuild-NUCLEO_F091RC -I../../lib/cmsis/inc -I../../lib/stm32lib/CMSIS/STM32F0xx/Include/ -I../../lib/stm32lib/STM32F0xx_HAL_Driver/Inc -Iusbdev/core/inc -Iusbdev/class/inc -Ilwip_inc -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib -DFFCONF_H=\"lib/oofatfs/ffconf.h\" -DSTM32F091xC -mthumb -msoft-float -mtune=cortex-m0 -mcpu=cortex-m0 -Os -DNDEBUG -Iboards/NUCLEO_F091RC -DSTM32_HAL_H='<stm32f0xx_hal.h>' -DMICROPY_HW_VTOR=0x08000000 -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT -fsingle-precision-constant -Wdouble-promotion -fdata-sections -ffunction-sections -c -MD -o build-NUCLEO_F091RC/pin.o pin.c
In file included from ../../py/mpstate.h:35:0,
from ../../py/runtime.h:29,
from pin.c:31:
build-NUCLEO_F091RC/genhdr/pins_af_const.h:67:55: error: 'GPIO_AF4_CAN1' undeclared here (not in a function); did you mean 'GPIO_AF4_CAN'?
{ MP_ROM_QSTR(MP_QSTR_AF4_CAN1), MP_ROM_INT(GPIO_AF4_CAN1) },
^
../../py/obj.h:87:67: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_uint_t)(small_int)) << 1) | 1))
^~~~~~~~~
build-NUCLEO_F091RC/genhdr/pins_af_const.h:67:44: note: in expansion of macro 'MP_ROM_INT'
{ MP_ROM_QSTR(MP_QSTR_AF4_CAN1), MP_ROM_INT(GPIO_AF4_CAN1) },
^~~~~~~~~~
Can it have something to do with the fact that the F0 has only one CAN port? Does pins.c somehow compare it to a different definition?
I have spent a lot of time debugging, looking around, etc. but to no avail.