Hi,
i'm new to souch complex project and i've some problem with i2c.
i've started from the STM32f£discovery example, as in the wiki "start with eclipse" or similar.
I've changed #define HAL_USE_MMC_SPI to TRUE, and I2CConfig structure get used, but OPMODE_I2C, FAST_DUTY_CYCLE_2, and almost all enum/function give an error as not defined. Everything is done in the main file.
what i'm missing?
problem with i2c and include
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: problem with i2c and include
Hi,
HAL_USE_MMC_SPI is not related to I2C, did you enable the I2C driver too?
Giovanni
HAL_USE_MMC_SPI is not related to I2C, did you enable the I2C driver too?
Giovanni
Re: problem with i2c and include
wops sorry, stupid copy paste, i mean HAL_USE_I2C. befor setting this to true, even "I2CConfig " was on error as undefined. After the define to TRUE I2CConfig error was solved just to open up a lot of other undefined; what bother me is that some enum are on the same file of the I2CConfig structure, so i can't undertand WHY they are not recognized!
maybe helps: RDY_OK is not defined, looked at the code, and saw it is now MSG_OK; but still get udefined error
Please note i'm using master from github (this mean chibiOS v3, if i'm not completly wrong), maybe there is some other config i should do?
ps. keep up with your great work! è fantastico
maybe helps: RDY_OK is not defined, looked at the code, and saw it is now MSG_OK; but still get udefined error
Please note i'm using master from github (this mean chibiOS v3, if i'm not completly wrong), maybe there is some other config i should do?
ps. keep up with your great work! è fantastico
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: problem with i2c and include
#define STM32_I2C_USE_I2C1 TRUE
i THINK i've already done that, have to check this.. if that won0t work, i'll post full code and error, i'm sure i'm missing something basic like this
i THINK i've already done that, have to check this.. if that won0t work, i'll post full code and error, i'm sure i'm missing something basic like this
Re: problem with i2c and include
gotcha, itis using i2cV2, witch does not declare that fields.
so there are diffent setup for different board, i was hoping for a "write once, run everywhere", but i'll get over it
so there are diffent setup for different board, i was hoping for a "write once, run everywhere", but i'll get over it
Re: problem with i2c and include
lesto wrote:gotcha, itis using i2cV2, witch does not declare that fields.
so there are diffent setup for different board, i was hoping for a "write once, run everywhere", but i'll get over it
It's a great ideal, but at some point you have to connect the dots between the abstraction and the specific hardware implementation. In ChibiOS/RT you can write most of your code abstracted from the specific hardware, e.g. using the HAL driver API, exception for the HAL driver configuration structure definitions -- that is where you specify the hardware configuration, usually with some platform-specific fields like OPMODE_I2C, FAST_DUTY_CYCLE_2, etc. You have the power to at that level configure some specific features of particular hardware, in addition to standard stuff like UART baud rate, etc. that might be common to all drivers.
You can quite easily put those hardware-specific configuration structures in separate source files or even separate directories from the rest of the hardware-independent application code. Then you can target your application for multiple hardware platforms.
Re: problem with i2c and include
nice answer, if the hw-dependant code is only in conf, then i can try to do what you said.
is there a "collection" of example for that specific configuration? so i can try to add multi-board support without reading hundred of datasheet.
ps. is possible to use only main? becouse i've written a code with only a main and some i2c, cleaned and builded the project, uploaded it, but when i step into code i find strange beaviur like loop where there are no loop, and optimized out variable when they are used as argument for delay. Also some variable not optimized out give strange value, like an array of 'U'
also, tryed to set up a new project again from the demo (just to be sure i didn't break something), deleted the thread's code leaving just main, and it give me a compilation error about something not found about thread (I know, i should post the error and souch, but i'm experimenting on time stealed for sleep, this weekend i hope to do something better)
finally eclipse's indexer is quite bizarre, it give me "reference not found", but ctrl+click on function/variable open un the right file at line declaration. maybe is this that is broking debugger? please note others project debug fine.
my nobbiness is giving me a lot of problem
is there a "collection" of example for that specific configuration? so i can try to add multi-board support without reading hundred of datasheet.
ps. is possible to use only main? becouse i've written a code with only a main and some i2c, cleaned and builded the project, uploaded it, but when i step into code i find strange beaviur like loop where there are no loop, and optimized out variable when they are used as argument for delay. Also some variable not optimized out give strange value, like an array of 'U'
also, tryed to set up a new project again from the demo (just to be sure i didn't break something), deleted the thread's code leaving just main, and it give me a compilation error about something not found about thread (I know, i should post the error and souch, but i'm experimenting on time stealed for sleep, this weekend i hope to do something better)
finally eclipse's indexer is quite bizarre, it give me "reference not found", but ctrl+click on function/variable open un the right file at line declaration. maybe is this that is broking debugger? please note others project debug fine.
my nobbiness is giving me a lot of problem