Problem with the I2C demo from the testhal directory
Posted: Fri Aug 16, 2013 3:04 pm
Hello Everybody,
I recently set up chibiOS on my STM32F4-Discovery and now tried some demos that came along with chibiOS v2.6.0RC1. After running the first demo, which is located in the "demos" directory, I tried to run the I2C demo from "testhal", since I'm going to need I2C on this board for an upcoming project. And so I loaded the project into workspace (I'm using chibiStudio) und flashed it to the STM32. As I opened a terminal in order to see the data coming from the accelerometer, I recognized that there was no output. After a short check I could exclude that the failure comes from the RS232, because of an initial text I sent and also I exchangend the board to ensure that the accelerometer is not broken. Finally I started debugging and found out, that this line of code causes the error:
status = i2cMasterTransmitTimeout(&I2CD2, mma8451_addr, txbuf, 2, rxbuf, 0, tmo);
The function terminates with a timeout flag, so that the next call to the I2C bus ends in a Kernel halt. I also set the timeout from 4 milliseconds to 100 milliseconds but had the same result.
Is there anyone, who has a running example for the I2C using the onboard accelerometer on a STM32F4-Discovery or has a clue how the problem can be solved?
Thank you in advance,
Pascal Klink
I recently set up chibiOS on my STM32F4-Discovery and now tried some demos that came along with chibiOS v2.6.0RC1. After running the first demo, which is located in the "demos" directory, I tried to run the I2C demo from "testhal", since I'm going to need I2C on this board for an upcoming project. And so I loaded the project into workspace (I'm using chibiStudio) und flashed it to the STM32. As I opened a terminal in order to see the data coming from the accelerometer, I recognized that there was no output. After a short check I could exclude that the failure comes from the RS232, because of an initial text I sent and also I exchangend the board to ensure that the accelerometer is not broken. Finally I started debugging and found out, that this line of code causes the error:
status = i2cMasterTransmitTimeout(&I2CD2, mma8451_addr, txbuf, 2, rxbuf, 0, tmo);
The function terminates with a timeout flag, so that the next call to the I2C bus ends in a Kernel halt. I also set the timeout from 4 milliseconds to 100 milliseconds but had the same result.
Is there anyone, who has a running example for the I2C using the onboard accelerometer on a STM32F4-Discovery or has a clue how the problem can be solved?
Thank you in advance,
Pascal Klink