Hello, this time I am facing a problem with I2CD1 driver of ChibiOS 2.5.0.
After initialization, I do:
i2cAcquireBus(i2cp);
i2c_ret = i2cMasterTransmitTimeout(i2cp, I2C_ADDR, txbuf, 3, rxbuf, 0, MS2ST(6));
i2cReleaseBus(i2cp);
i2cAcquireBus(i2cp);
i2c_ret = i2cMasterTransmitTimeout(i2cp, I2C_ADDR, txbuf, 8, rxbuf, 0, MS2ST(6));
i2cReleaseBus(i2cp);
The second writing sequence hangs!
I tried in the following manners:
1) just the second writing sequence;
2) with no other peripherals enabled (uart, spi, ecc...)
3) double checked board.h configuration, and it's fine, PB6 and PB7 configured as alternate open drain.
I have 2k pullup resistor on each lines.
Could you please help me?
-g
stm32f103C and chibios 2.5.0: i2cd1 driver hangs!
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: stm32f103C and chibios 2.5.0: i2cd1 driver hangs!
Hi,
Hangs exactly where? does it go into an unhandled exception or what?
Giovanni
Hangs exactly where? does it go into an unhandled exception or what?
Giovanni
Re: stm32f103C and chibios 2.5.0: i2cd1 driver hangs!
Well, each time I strike ctrl-c on debugger, it shows up:
port_halt() at ....... chcore.c:43
does it help?
port_halt() at ....... chcore.c:43
does it help?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: stm32f103C and chibios 2.5.0: i2cd1 driver hangs!
Are you running with debug options enabled? port_halt() is called when some assertion fails.
When you get this kind of errors 90% of times it is a problem of stack overflow, you should verify that.
If you debug from inside Eclipse the ChibiOS debug plugin can also retrieve the error message for you.
Giovanni
When you get this kind of errors 90% of times it is a problem of stack overflow, you should verify that.
If you debug from inside Eclipse the ChibiOS debug plugin can also retrieve the error message for you.
Giovanni
Re: stm32f103C and chibios 2.5.0: i2cd1 driver hangs!
Ok, could be a buffer overflow, but I am just managing a few bytes, and rx and tx buffer are 256 bytes long.
PS. I enhanced the stack size of the process from 128 bytes to 256 bytes and it worked.
Now, could you please suggest me a lecture or a link, in order to find the right size for process stack?
Why does it happened?
-g
PS. I enhanced the stack size of the process from 128 bytes to 256 bytes and it worked.
Now, could you please suggest me a lecture or a link, in order to find the right size for process stack?
Why does it happened?
-g
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: stm32f103C and chibios 2.5.0: i2cd1 driver hangs!
Hi, the debug plugin shows exactly how much stack is used for each thread. Alternatively, activate the stack filler option and inspect memory (this is what the plugin does automatically).
Giovanni
Giovanni
Re: stm32f103C and chibios 2.5.0: i2cd1 driver hangs!
Ok Giovanni, I will try to do it (I do not use eclipse).
Well, for the second time in one day, let me thank you for your great cooperation.
Bye
-g
Well, for the second time in one day, let me thank you for your great cooperation.
Bye
-g
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: stm32f103C and chibios 2.5.0: i2cd1 driver hangs!
You are welcome.
I am stressing with Eclipse because the debug facility is really important, it is worth to invest some time for the setup.
Giovanni
I am stressing with Eclipse because the debug facility is really important, it is worth to invest some time for the setup.
Giovanni