Page 1 of 2
CB3.0 F100 - I2C issues
Posted: Sun Oct 06, 2013 12:16 pm
by pito
Code: Select all
Thread [1] (Suspended: Signal 'SIGINT' received. Description: Interrupt.)
5 chSysHalt() core_cmFunc.h:342 0x08001018
4 i2c_lld_set_clock() i2c_lld.c:188 0x08001018
3 i2c_lld_start() i2c_lld.c:629 0x08001018
2 i2cStart() i2c.c:105 0x08001018
1 main() main.c:253 0x08001018
at
Code: Select all
osalDbgAssert((STM32_PCLK1 % (clock_speed * 25)) == 0,
"PCLK1 must be divided without remainder");
with
Code: Select all
static const I2CConfig i2cfg1 = { OPMODE_I2C, 400000, FAST_DUTY_CYCLE_16_9 }
@24MHz clock
With:
Code: Select all
static const I2CConfig i2cfg1 = { OPMODE_I2C, 400000, FAST_DUTY_CYCLE_2 }
I get always:
Code: Select all
Thread [1] (Suspended: Signal 'SIGINT' received. Description: Interrupt.)
7 chSysHalt() core_cmFunc.h:342 0x08002dfc
6 _dbg_check_lock() chdebug.c:119 0x08002dfc
5 chSysLock() chsys.h:290 0x0800322c
4 i2c_lld_master_transmit_timeout() osal.h:377 0x0800322c
3 i2cMasterTransmitTimeout() i2c.c:189 0x080009ca
2 RTC_PCF8563_isrunning() chTinyRTC8563.c:165 0x080009ca
1 main() main.c:260 0x080009ca
Re: CB3.0 F100 - I2C issues
Posted: Sun Oct 06, 2013 5:02 pm
by Giovanni
I don't see errors, you cannot select that specific combination of parameters, you have to respect constraints when specifying the working parameters.
See the documentation of the I2C CCR register.
Giovanni
Re: CB3.0 F100 - I2C issues
Posted: Sun Oct 06, 2013 5:46 pm
by pito
I run with
Code: Select all
static const I2CConfig i2cfg1 = { OPMODE_I2C, 400000, FAST_DUTY_CYCLE_16_9 }
and 40MHz clock my code fine under trunk.
The same with 3.0 (and w/ the changes we discussed earlier) stops. So there must be something different, I do not see on the third glance

I see a new parameter
there. Maybe something related to?
Re: CB3.0 F100 - I2C issues
Posted: Sun Oct 06, 2013 6:09 pm
by Giovanni
Nope, that is unrelated.
Probably you just run without assertions enabled on trunk code, that part of the code didn't change at all.
Giovanni
Re: CB3.0 F100 - I2C issues
Posted: Sun Oct 06, 2013 6:32 pm
by pito
It hangs on
Code: Select all
RTC_PCF8563_status = i2cMasterTransmitTimeout(&I2CD1, PCF8563_ADDRESS, txbuf, 1, rxbuf, 9, TMO);
Re: CB3.0 F100 - I2C issues
Posted: Sun Oct 06, 2013 6:41 pm
by Giovanni
Hangs, how? halt, exception, assertion, simply no return? more info would help, I have no HW to test this driver right now.
Giovanni
Re: CB3.0 F100 - I2C issues
Posted: Sun Oct 06, 2013 9:11 pm
by pito
As indicated above:
Code: Select all
Thread [1] (Suspended: Signal 'SIGINT' received. Description: Interrupt.)
7 chSysHalt() core_cmFunc.h:342 0x08002e1c
6 _dbg_check_lock() chdebug.c:119 0x08002e1c
5 chSysLock() chsys.h:290 0x0800324c
4 i2c_lld_master_transmit_timeout() osal.h:377 0x0800324c
3 i2cMasterTransmitTimeout() i2c.c:189 0x080009dc
2 RTC_PCF8563_isrunning() chTinyRTC8563.c:165 0x080009dc
1 main() main.c:263 0x080009dc
Code: Select all
uint8_t RTC_PCF8563_isrunning(void) {
uint8_t rxbuf[RTC_PCF8563_RX_DEPTH];
uint8_t txbuf[1];
txbuf[0]= 0x00;
i2cAcquireBus(&I2CD1);
>>> RTC_PCF8563_status = i2cMasterTransmitTimeout(&I2CD1, PCF8563_ADDRESS, txbuf, 1, rxbuf, 9, TMO);
i2cReleaseBus(&I2CD1);
if (RTC_PCF8563_status==RDY_OK) return TRUE;
else return FALSE;
}
TMO is: #define TMO MS2ST(20)
Re: CB3.0 F100 - I2C issues
Posted: Mon Oct 07, 2013 8:44 am
by pito
In RT-STMF100-DISCOVERY there is probably wrong def
What I do not understand yet is my compiled code under 3.0 is 5kB smaller than with trunk..
Code: Select all
3.0:
text data bss dec hex filename
14384 428 4528 19340 4b8c build/ch.elf
trunk:
text data bss dec hex filename
19492 356 4416 24264 5ec8 build/ch.elf
The mcuconf, cbconf, halconf, Makefile almost identical (plus minus changes with 3.0).
Re: CB3.0 F100 - I2C issues
Posted: Mon Oct 07, 2013 9:56 am
by Giovanni
Probably because LTO is now enabled by default. I will fix the makefiles but it should not affect anything.
Giovanni
Re: CB3.0 F100 - I2C issues
Posted: Mon Oct 07, 2013 10:56 am
by pito
LTO disabled:
Code: Select all
text data bss dec hex filename
17364 428 4528 22320 5730 build/ch.elf
2kB less, do I miss something there?
Still hangs on the I2C..
I removed the I2C stuff, printing some adc values and systime, ( with spi, adc, and pwm chunks from demos) in a loop. It does few loops, prints, then stops at 80msec with unhandled exception.. Probably there is more changes as I am aware..
