Forum Discussion
8 Replies
- AnandRaj_S_Intel
Regular Contributor
Hi Roman,
Can you share the design?
Your driver & Qsys system looks fine, Need to check the software side.
Regards
Anand
- Inematov
New Contributor
- Inematov
New Contributor
- AnandRaj_S_Intel
Regular Contributor
Hi Roman,
Okay,
For debugging can you try to read slave device address using alt_avalon_i2c_master_target_get.
Refer below link for API example.
https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_embedded_ip.pdf
Regards
Anand
- Inematov
New Contributor
Hi Anand
With the code in the attachment i get the following output:
Hello from Nios II!
targetadress 0x0
Error
Read chip ID: Read chip ID: Read chip ID: Read chip ID: Read chip ID: Data
Data
Data
Data
so it seems he even do not set the target address 0x76.
When i use the oscilloscope, there is no communication on the pins.
Thank you!
Regards
Roman
- AnandRaj_S_Intel
Regular Contributor
Hi Roman,
Is your BME280 SDO pin connected to the ground? check hardware connectivity.
Try to read the slave address without writing it.
Regards
Anand
- Inematov
New Contributor
Hi Anand
Oh i found the wiring issue... (unbelivable :( )
However, now i`m back at my initial problem, that the slave sends me some data that i am not expecting.
In the attachment is an oscilloscope picture, communication via NIOS2. The Slave sends me wrong data, but i a don`t know why and how i can control that from NIOS. (An osci picture from an working communication via arduino is in my first post)
I thought it is a missing initialization step but i can`t find any difference to the examples from Bosch.
alt_u32 txbuffer[0x200]; alt_u32 rxbuffer[0x200]; txbuffer[0] = 0xFA; //MSB txbuffer[1] = 0xFB; //LSB txbuffer[2] = 0xFC; //XLSB while (1) { status = alt_avalon_i2c_master_tx_rx(i2c_dev, txbuffer, 1, rxbuffer, 3, ALT_AVALON_I2C_NO_INTERRUPTS); usleep(1000000); } - AnandRaj_S_Intel
Regular Contributor
Hi,
- Temperature data may be randomly changing better read some other register.
- The tx buffer contains the 1-byte address, Is address (FA)correct ???
it should be 2 bytes FA & FB for temperature data.
Instead of reading temp data, read chip id and check if you are getting expected output for debugging.
Buffer[0]=D0;
alt_avalon_i2c_master_tx_rx(i2c_ptr,buffer,1,buffer,1,0);
Regards
Anand