Altera_Forum
Honored Contributor
20 years agoProblem interfacing to external logic
Hi,
I need to include some external peripherals in a custom design, one of them is implemented using a MAX-II device, others are commercial chips, they all require several address and control lines (e.g. A3 downto A0, nCS, nRD, nWR, etc.) to access some control and configuration registers. People say this is piece of cake using the interface to user logic component from the SOPCBuilder...but it does not work for me. If I write to any address in the address space of the peripheral (using the stbio cpu instruction for ensuring that no cache operation is done at all), but I always get wrong values in the nios address bus lines (some bits are almost erratic). The Avalon bus documentation says that all access to tristate avalon slaves are byte addresses. For generating the peripheral control lines I included a very simple VHDL code that defines the connections to the Avalon bus (read, reset, write, chipselect, address[3..0] and data[7..0]) and creates the combinational logic that I need for accessing the peripherals (onCS, onRD, onWR, oRST). oRST is implemented as a one bit register, set by a write to address __BASE + 0xF. I marked the Avalon bus lines address, reset, read, write and data as "shared" and the bus interface type as avalon register slave. The first thing I found strange was that an extra data bus appeared after generating the nios with the SOPCBuilder, this one related to the user logic I inserted. Is this normal? What is this for? No matter what address I write to (inside the address space of the device), the nios address lines that are shared always carry wrong values. Could someone give me some tip(s) for solving this issue? Is there anything I'm missing here? Thanks a lot in advance!