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
Problem with the I2C demo from the testhal directory
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problem with the I2C demo from the testhal directory
Hi,
The accelerometer on the F4-Discovery is connected through an SPI not an I2C. The correct demo you should use is ./demos/ARMCM4-STM32F407-DISCOVERY-MEMS.
Giovanni
The accelerometer on the F4-Discovery is connected through an SPI not an I2C. The correct demo you should use is ./demos/ARMCM4-STM32F407-DISCOVERY-MEMS.
Giovanni
Re: Problem with the I2C demo from the testhal directory
Hi Giovanni,
thank you for the quick help. Now I know I don't have to be curious about this issue and can move on to connecting external devices to the I2C bus.
Pascal Klink
thank you for the quick help. Now I know I don't have to be curious about this issue and can move on to connecting external devices to the I2C bus.
Pascal Klink
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problem with the I2C demo from the testhal directory
Hi,
I2C can be problematic on the STM32 up to the F4 because HW quircks (F0, F3 and following use a new peripheral).
We went into a lot of trouble in order to get a stable driver, please make sure to read the guide here: http://www.chibios.org/dokuwiki/doku.ph ... e_shooting
Giovanni
I2C can be problematic on the STM32 up to the F4 because HW quircks (F0, F3 and following use a new peripheral).
We went into a lot of trouble in order to get a stable driver, please make sure to read the guide here: http://www.chibios.org/dokuwiki/doku.ph ... e_shooting
Giovanni
Re: Problem with the I2C demo from the testhal directory
pklink,
That test was written for special board not Discovery. Because Discovery has no I2C peripherals.
That test was written for special board not Discovery. Because Discovery has no I2C peripherals.