Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

8 bit dynamic alignment for SPI device?

Hello!

I've designed controller for NVRAM memory with SPI interface.

I've create component as memory slave device with 8 bit data bus (I don't want to use

this as register slave).

When I write to memory all is OK (address, cs, write signals are correct), but when I was tried to read

address bus is wrong.

For example:

unsigned char *p = (unsigned char*) FRAM1_BASE;

int main(void)

{

p[0] = (unsigned char) 0xDC;

printf("%02x\n", (unsigned char) p[0]);

p[1] = (unsigned char) 0xCD;

printf("%02x\n", (unsigned char) p[1]);

return 0;

}

I've simuleted it and got next:

When to p[0] or p[1] I write some value it is writing correct,

but when it is reading - address bus sets to 0, after to 1, after to 2, after to 3 (in both case).

All this time chipselect is active and read signal too.

Therefore when I'm reading p[1], there always p[0], because p[0] was read first.

What's wrong?

Any idea?

Thx.

10 Replies