i2c hangs when reading just one byte
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: i2c hangs when reading just one byte
Not sure, if the fault is immediate you should be able to step into it. Make sure to enable debug options, something could be trapped before the fault.
Giovanni
Giovanni
Re: i2c hangs when reading just one byte
Debug options always on. I can not step in program before fault because it raise too early. All that I can is press "pause" in eclipse and look in stack:
Debugger also behaves strange
and OpenOCD
Code: Select all
Thread [1] (Suspended: Signal 'SIGINT' received. Description: Interrupt.)
3 <symbol is not available> 0xffbaabe0
2 <symbol is not available> 0xfffffffc
1 <symbol is not available> 0xfffffffc
Debugger also behaves strange
Code: Select all
thbreak main
Hardware assisted breakpoint 4 at 0x80c0192: file main.c, line 69.
continue
Note: automatically using hardware breakpoints for read-only addresses.
Program received signal SIGINT, Interrupt.
0xffbaabe0 in ?? ()and OpenOCD
Code: Select all
Error: JTAG-DP STICKY ERROR
Error: MEM_AP_CSW 0x23000051, MEM_AP_TAR 0x280002ec
Error: stm32f4xxx.cpu -- clearing lockup after double fault
Polling target failed, GDB will be halted. Polling again in 100ms
Polling succeeded again- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: i2c hangs when reading just one byte
This is very strange, are you at least able to reach the main function?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: i2c hangs when reading just one byte
The only thing executed before the main is __early_init() that usually just does clock initialization, you should verify your clock settings.
Giovanni
Giovanni
Re: i2c hangs when reading just one byte
As i have said before, i have extracted my project so that it is no more included in chibios directory
and it compile with chibios from git.
now that i have done this, reading one byte just work ...
as previously, when my project was in chibios directory, chibios was uptodate,
i really don't understand where was the problem.
I have bought a book on git, perhaps i will find solution in it
I have read post from barthess about problem when compiling with optimisation, and i have same
problem, but again, it's weird :
if i flash pgm compiled in O0, then flash pgm compiled in O2, pgm fail before entering main.
if i flash pgm compiled in O0, then flash pgm compiled in O1, then flash pgm compiled in O2, it's work in all the three mode, is it the same
for you barthess ?
Alexandre
and it compile with chibios from git.
now that i have done this, reading one byte just work ...
as previously, when my project was in chibios directory, chibios was uptodate,
i really don't understand where was the problem.
I have bought a book on git, perhaps i will find solution in it
I have read post from barthess about problem when compiling with optimisation, and i have same
problem, but again, it's weird :
if i flash pgm compiled in O0, then flash pgm compiled in O2, pgm fail before entering main.
if i flash pgm compiled in O0, then flash pgm compiled in O1, then flash pgm compiled in O2, it's work in all the three mode, is it the same
for you barthess ?
Alexandre
Re: i2c hangs when reading just one byte
alex31 wrote:if i flash pgm compiled in O0, then flash pgm compiled in O2, pgm fail before entering main.
if i flash pgm compiled in O0, then flash pgm compiled in O1, then flash pgm compiled in O2, it's work in all the three mode, is it the same
for you barthess ?
Looks very similar but not always the same.
Bug reproducible on testhal/STM32F4xx/I2C project when compiled with -Os
My own project reduced to blink + main threads now works with -O2 but failed with -Os.
-Os is the most buggy option.
I use
Code: Select all
gcc version 4.6.2 20120316 (release) [ARM/embedded-4_6-branch revision 185452] (GNU Tools for ARM Embedded Processors)
Open On-Chip Debugger 0.5.0 (v0.6.0-rc2 also tried with no differences)
Chibios trunk rev.4739May it be bug in toolchain?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: i2c hangs when reading just one byte
Does manually erasing flash before reprogramming fix the problem?
Giovanni
Giovanni