ussserrr / stm32pio

Automate managing of STM32CubeMX + PlatformIO projects
https://pypi.org/project/stm32pio
Other
230 stars 24 forks source link

Can not generate code with I2C support #13

Closed romychs closed 4 years ago

romychs commented 4 years ago

Have success with generation code for bluePill board with STM32F103C8T6, but after turning ON I2C 1 in Stm32CubeMX I am get error:

romych@home_pc ~/projects/TEnco % stm32pio generate                                                                             
INFO     starting to generate a code from the CubeMX .ioc file...
ERROR    2020-04-14 21:25:39,422 [ERROR] IPConfigManager:1272 - ERROR: the RefConfig I2C_Analogue is not available in your config.xml file
2020-04-14 21:25:39,422 [ERROR] IPConfigManager:1272 - ERROR: the RefConfig I2C_DigitalFolter is not available in your config.xml file
ERROR    Exception: code generation error

Env: LinuxMint 19, fresh platformio v 4.3.1, fresh Stm32CubeMX v 5.6.1, VS Code v1.44

TEnco.zip

romychs commented 4 years ago

I think, it is CubeMX issue, not stm32pio...

ussserrr commented 4 years ago

Yea, I think so, too. Are you able to generate the code from the same configuration using the ordinary GUI version of CubeMX?

svenikea commented 4 years ago

I think, it is CubeMX issue, not stm32pio...

I don't think so mate mine was perfectly fine I'm using manjaro

[john@t440s testing]$ stm32pio generate
INFO     starting to generate a code from the CubeMX .ioc file...
INFO     successful code generation
INFO     exiting...
[john@t440s testing]$ tree
.
├── Inc
│   ├── gpio.h
│   ├── i2c.h
│   ├── main.h
│   ├── stm32f1xx_hal_conf.h
│   └── stm32f1xx_it.h
├── lib
│   └── README
├── platformio.ini
├── Src
│   ├── gpio.c
│   ├── i2c.c
│   ├── main.c
│   ├── stm32f1xx_hal_msp.c
│   ├── stm32f1xx_it.c
│   └── system_stm32f1xx.c
├── stm32pio.ini
├── test
│   └── README
├── testing.gpdsc
└── testing.ioc

Maybe some I2C config is not compatible with this setup

ussserrr commented 4 years ago

OK, I've been able to replicate this issue. This is indeed the stm32pio bug, but... CubeMX doesn't return any error code when it encounters the problem and just always returns 0. So there is a little bit hacky solution to detect when the real error has occurred and when not. Currently, I look for the ERROR string to appear in the logs to mark the action as failed. Apparently, in your case ERROR is just a part of a normal process so this logic has failed. stm32pio sees it and interrupts the execution. Need to find out the other way of distinguishing the problems, probably the final OK string is a good indicator. Need to be fixed.

ussserrr commented 4 years ago

Parsing behavior of CubeMX output is changed in the new version, close.

romychs commented 4 years ago

Thanks for the new release!