I try to interface my XMOS chip with a Blackfin DSP, using SPI, Blackfin as master, XMOS as slave. I followed the AN00161, "How to use the SPI library as SPI slave", so that I can try to read SPI registers from Blackfin. The registers are initialized to a dedicated value in the XMOS app init:
Code: Select all
spi_reg.set_reg(0, 0xA0);
spi_reg.set_reg(1, 0xA1);
spi_reg.set_reg(2, 0xA2);
spi_reg.set_reg(3, 0xA3);
spi_reg.set_reg(4, 0xA4);
Code: Select all
UN8 xmos_reg[5];
UN8 xmos_read_reg(UN8 reg)
{
UN8 b;
cpu_gpio_clear(spi_cs);
cpu_spi_write(spi, READ_REG);
cpu_spi_write(spi, reg);
b = cpu_spi_write(spi, 0);
cpu_gpio_set(spi_cs);
return b;
}
xmos_reg[0] = xmos_read_reg(0);
xmos_reg[1] = xmos_read_reg(1);
xmos_reg[2] = xmos_read_reg(2);
xmos_reg[3] = xmos_read_reg(3);
xmos_reg[4] = xmos_read_reg(4);
What I expected:
Code: Select all
xmos_reg[0]: 0xA0;
xmos_reg[1]: 0xA1;
xmos_reg[2]: 0xA2;
xmos_reg[3]: 0xA3;
xmos_reg[4]: 0xA4;
Code: Select all
xmos_reg[0]: 0xA0;
xmos_reg[1]: 0xA0;
xmos_reg[2]: 0xA1;
xmos_reg[3]: 0xA2;
xmos_reg[4]: 0xA3;
Code: Select all
xmos_reg[0]: 0xA4;
xmos_reg[1]: 0xA0;
xmos_reg[2]: 0xA1;
xmos_reg[3]: 0xA2;
xmos_reg[4]: 0xA3;
There is also another strange behavior: the MISO signal seems to be driven by the XMOS even after the SS becomes high. Is this a known bug?
Any help warmly appreciated. Thanks for your support,
Vincent