CB3.0 F100 - I2C issues

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

CB3.0 F100 - I2C issues

Postby pito » Sun Oct 06, 2013 12:16 pm

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   

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: CB3.0 F100 - I2C issues

Postby Giovanni » Sun Oct 06, 2013 5:02 pm

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

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: CB3.0 F100 - I2C issues

Postby pito » Sun Oct 06, 2013 5:46 pm

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

Code: Select all

#define STM32_I2C_BUSY_TIMEOUT              50
there. Maybe something related to?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: CB3.0 F100 - I2C issues

Postby Giovanni » Sun Oct 06, 2013 6:09 pm

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

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: CB3.0 F100 - I2C issues

Postby pito » Sun Oct 06, 2013 6:32 pm

It hangs on

Code: Select all

RTC_PCF8563_status = i2cMasterTransmitTimeout(&I2CD1, PCF8563_ADDRESS, txbuf, 1, rxbuf, 9, TMO);

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: CB3.0 F100 - I2C issues

Postby Giovanni » Sun Oct 06, 2013 6:41 pm

Hangs, how? halt, exception, assertion, simply no return? more info would help, I have no HW to test this driver right now.

Giovanni

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: CB3.0 F100 - I2C issues

Postby pito » Sun Oct 06, 2013 9:11 pm

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)

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: CB3.0 F100 - I2C issues

Postby pito » Mon Oct 07, 2013 8:44 am

In RT-STMF100-DISCOVERY there is probably wrong def

Code: Select all

MCU  = cortex-m4


What I do not understand yet is my compiled code under 3.0 is 5kB smaller than with trunk.. :shock:

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).

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: CB3.0 F100 - I2C issues

Postby Giovanni » Mon Oct 07, 2013 9:56 am

Probably because LTO is now enabled by default. I will fix the makefiles but it should not affect anything.

Giovanni

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: CB3.0 F100 - I2C issues

Postby pito » Mon Oct 07, 2013 10:56 am

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.. :)


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 11 guests