Trying to test SPI on J6 with the simple program:
#include "xspi.h"
#include "xparameters.h"
#include "xil_printf.h"
#include "sleep.h"
int main() {
xil_printf("Hello World!\r\n");
static XSpi device;
XSpi_Config *pcfg;
int status;
pcfg = XSpi_LookupConfig(XPAR_SPI_0_DEVICE_ID);
xil_printf("Spi_LookupConfig = %d\r\n", pcfg);
status = XSpi_CfgInitialize(&device, pcfg, pcfg->BaseAddress);
xil_printf("XSpi_CfgInitialize = %d\r\n", status);
status = XSpi_SetOptions(&device, XSP_MASTER_OPTION | XSP_MANUAL_SSELECT_OPTION);
xil_printf("XSpi_SetOptions = %d\r\n", status);
status = XSpi_Start(&device);
xil_printf("XSpi_Start = %d\r\n", status);
XSpi_IntrGlobalDisable(&device);
xil_printf("XSpi_IntrGlobalDisable = %d\r\n", status);
status = XSpi_SetSlaveSelect(&device, 0b1);
xil_printf("XSpi_SetSlaveSelect = %d\r\n", status);
u8 bytes [4] = {0x01,0x02,0x03,0x04};
xil_printf("Before loop starts\r\n");
while (1) {
xil_printf("loop...\r\n");
status = XSpi_Transfer(&device, bytes, NULL, 4);
xil_printf("XSpi_Transfer = %d\r\n",status);
usleep(1);
}
}
Output:
Hello World!
Spi_LookupConfig = 9300
XSpi_CfgInitialize = 0
XSpi_SetOptions = 0
XSpi_Start = 0
XSpi_IntrGlobalDisable = 0
XSpi_SetSlaveSelect = 0
Before loop starts
loop...
on attached screenshot I see only two bytes are sent out and that is it, why?