I'm working on logging to sd card over spi using 2.4.3 kernel. SD card is mounted only if I don't call i2cStart() before. If I call i2cStart(), the initialisation never occurs.
I have separate sd insertion/removal monitoring thread:
Code: Select all
static WORKING_AREA(waSDcard_monitor, 128);
static msg_t t_SDcard_monitor(void *arg) {
(void)arg;
chEvtRegister(&MMCD1.inserted_event, &el0, 0);
chEvtRegister(&MMCD1.removed_event, &el1, 1);
while (TRUE) {
chEvtDispatch(evhndl, chEvtWaitOne(ALL_EVENTS));
}
return (msg_t) 0;
}I2C stuff:
Code: Select all
static const I2CConfig i2cfg1 = {
OPMODE_I2C,
400000, /* 400 kHz */
FAST_DUTY_CYCLE_2,
};
void I2CInit_pns(){
i2cStart(&I2CD2, &i2cfg1);
chThdSleepMilliseconds(100);
}
It doesn't matter if I call i2cStart() before creating the thread of afterwards. Any idea what interaction between these two can be?