I have a custom PMOD and I want to communicate with it via SPI using the JA1 connector. (my pins are 1-SSN, 2-MOSI, 3-MISO, 4 SLCK). I'm trying to repurpose an existing SPI program for an entirely different PMOD that talks through SPI with the Zync. I am not entire sure if they're somehow setting the GPIO2 ports to be one directional only (see comment // Set the GPIO2 direction to outputs) and just reading from the device instead of writing to it. I would think you'd need to 'send' it read requests and then 'read' it back therefore enabling you to both write and read. The project I'm using as a starter is the maxrefdes12f set of files found here http://www.maximintegrated.com/app-notes/index.mvp/id/5611 which only uses the MISO pin and not the MOSI as well. I want to use both. Can someone help in pointing out if the maxrefdes12f initializes both MISO and MOSI pins? Thanks!!!
// Variables for the main() function
tchar tempString[256];
t// Xilinx provided utility to initialize the hardware/firmware drivers and enable/disable cache
tinit_platform();
t// Toggle the LEDs so that the user knows the board is awake
tXGpio_Initialize(&g_xGpioLed, XPAR_AXI_GPIO_LED_DEVICE_ID);
tXGpio_SetDataDirection(&g_xGpioLed, 1, 0x00000000);t// Set the LED peripheral to outputs
tled_knight_rider(&g_xGpioLed,2);
t// Initialize the OLED Data structure, the underlying hardware, ...
t// ...and pass a pointer to the active 8x8 pixel font
tinitializeOLED(font);
t// Print Welcome Message on OLED
//deleted
t// Initialize the GPIO connected to PMOD Ports A,B,C,D
tXGpio_Initialize(&g_xGpioPmodPortA, XPAR_AXI_GPIO_0_DEVICE_ID);
tXGpio_Initialize(&g_xGpioPmodPortB, XPAR_AXI_GPIO_1_DEVICE_ID);
tXGpio_Initialize(&g_xGpioPmodPortC, XPAR_AXI_GPIO_2_DEVICE_ID);
tXGpio_Initialize(&g_xGpioPmodPortD, XPAR_AXI_GPIO_3_DEVICE_ID);
tXGpio_SetDataDirection(&g_xGpioPmodPortA, 1, 0x00000000);t// Set the GPIO1 to all be outputs
tXGpio_SetDataDirection(&g_xGpioPmodPortB, 1, 0x00000000);t// Set the GPIO1 to all be outputs
tXGpio_SetDataDirection(&g_xGpioPmodPortC, 1, 0x00000000);t// Set the GPIO1 to all be outputs
tXGpio_SetDataDirection(&g_xGpioPmodPortD, 1, 0x00000000);t// Set the GPIO1 to all be outputs
t// Inialize the GPIO that drives the mux/select bits on the PMOD port multiplexer
tXGpio_Initialize(&g_xGpioPmodPortMuxIO, XPAR_AXI_GPIO_PMODPORTMUX_DEVICE_ID);
tXGpio_SetDataDirection(&g_xGpioPmodPortMuxIO, 1, 0x00); // Set the GPIO2 direction to outputs
t// Initialize the ports 0..3 (A..D) with the appropriate technology
t// PMOD_PORT_TYPE_UART, PMOD_PORT_TYPE_SPI, PMOD_PORT_TYPE_GPIO, PMOD_PORT_TYPE_I2C
tg_auchPortType[0] = PMOD_PORT_TYPE_I2C;
tg_auchPortType[1] = PMOD_PORT_TYPE_I2C;
tg_auchPortType[2] = PMOD_PORT_TYPE_I2C;
tg_auchPortType[3] = PMOD_PORT_TYPE_I2C;
t// Configure the PMOD Port Multiplexers for the appropriate PMOD interfaces (ports a,b,c,d)
tmax_configure_PMOD_port(g_auchPortType[0],g_auchPortType[1],g_auchPortType[2],g_auchPortType[3]);
t// Set port0 (PMOD A, JA1) type to SPI
tmax_set_PMOD_port(0, PMOD_PORT_TYPE_SPI);