cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Loopback using bare-metal code

maya16
Associate

Hello All, I am trying to do a loopback test between 2 i2c's on the same board, using bare metal coding and interrupts, and the clk is HSI, 16MHz. How the i2c i configured as slave is failing to acknowledge the address sent by master i2c.
Here is a zip file containing the project.

3 REPLIES 3
Andrew Neil
Super User

You already have a thread on this - marked as solved:

I2C Loopback Test using STM32F429ZI

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

That was using HAL(API), this is register level programming.

So compare what happens in your bare-metal code with what happens in the (working) HAL code.

Step through both of them - see where they differ.

The chip neither knows nor cares what your code uses - it just needs to have the correct register setting, etc.

 

PS:

You seem to have switched both slave and master to bare-metal.

It would be more sensible to do just one at a time - otherwise you don't know whether the problem(s) are in the Master, or the Slave - or both!

https://community.st.com/t5/stm32-mcus-products/two-nucleo-boards-stm32f446re-and-stm32h723zg-communicate/m-p/737695/highlight/true#M264992

 


@maya16 wrote:

slave is failing to acknowledge the address sent by master i2c.


So is the master actually sending the correct address?

Or is the Slave not correctly recognising its address?

Or both?!

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.