Hi guys,
First off, I just started using FPGAs about a month ago, and am only just beginning to use Nios II, so suffice to say I am very new to this.
I'm working with a DE0 Nano on project for which I am using the OpenCores I2C ported to the Avalon bus found on the AlteraWiki. I want to use it to communicate with an external IMU sensor board that I have. If you've successfully used this in the past, please have a quick read and see if you can help me out.
I've used SOPC builder to design the system (see screenshot attached).
This the code in Eclipse that I am using:
Turning on the debug flag returns the following:
The base address is the same as the one in SOPC builder.
When initialising I2C, I am assuming the clock signal should be observable using a logic analyser on the output pin, so I have assigned the signal to GPIO pin 33. However, the signal remains stuck at VCC. I don't know what is causing this error. I have tried mapping the signal to an LED and using a very low I2C clock frequency to see if it's stuck at VCC or if the initialisation has no effect at all, but the LED stays at GND. So my guess is that the problem lies in linking the I2C component with the output pins.
If you could help me out it would be greatly appreciated.
Thanks!
PS: I don't whether this is of concern, but for some reason Quartus warns me during compilation that clk_50 hasn't been assigned as a clock.
First off, I just started using FPGAs about a month ago, and am only just beginning to use Nios II, so suffice to say I am very new to this.
I'm working with a DE0 Nano on project for which I am using the OpenCores I2C ported to the Avalon bus found on the AlteraWiki. I want to use it to communicate with an external IMU sensor board that I have. If you've successfully used this in the past, please have a quick read and see if you can help me out.
I've used SOPC builder to design the system (see screenshot attached).
This the code in Eclipse that I am using:
Code:
#include <stdio.h>
#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "i2c_opencores.h"
int main()
{
printf("Hello from Nios II on steroids (SDRAM) !\n");
// initialise I2C Core at 100kHz
I2C_init(I2C_0_BASE,ALT_CPU_FREQ,100000);
return 0;
}
Code:
Hello from Nios II on steroids (SDRAM) !
Initializing I2C at 0x0,
with clock speed 0x2faf080
and SCL speed 0x186a0
and prescale 0x63
When initialising I2C, I am assuming the clock signal should be observable using a logic analyser on the output pin, so I have assigned the signal to GPIO pin 33. However, the signal remains stuck at VCC. I don't know what is causing this error. I have tried mapping the signal to an LED and using a very low I2C clock frequency to see if it's stuck at VCC or if the initialisation has no effect at all, but the LED stays at GND. So my guess is that the problem lies in linking the I2C component with the output pins.
If you could help me out it would be greatly appreciated.
Thanks!
PS: I don't whether this is of concern, but for some reason Quartus warns me during compilation that clk_50 hasn't been assigned as a clock.