Thank you for your comment.
I tested several cases according to your comments.
But, I can't control QSPI_PCS2 and QSPI_PCS3 on MCF52259EVB.
Followings are my code snippet.
Is there any missing from my source code?
Thanks in advance.
....#include <spi_mcf5xxx_qspi.h>#include <mcf5xxx_qspi.h>....FILE_PTR spi_fd;...... spi_fd = fopen("spi0:", NULL); if (spi_fd==NULL ) { TRACE(1, "SPI_DriverOpen() Failed. Exiting...\n"); _time_delay(200L); _mqx_exit(-1); }uint_32 param;...... // I want to select the appropriate CS_PIN in HERE. // // MCF52259 pin assign is following from MCF52259DS.pdf // ----------------------------------------------- // Pramary Secondary Tertiary Quaternary // ----------------------------------------------- // QSPI_CS3 SYNCA USB_DP_PDOWN PQS6 // QSPI_CS2 SYNCB USB_DM_PDOWN PQS5 // QSPI_CS0 I2C_SDA0 UCTS1 PQS3 // ----------------------------------------------- // param = (GPIO_PORT_QS | GPIO_PIN3); // Works fine with QSPI_CS0 // param = (GPIO_PORT_QS | GPIO_PIN5); // Works fine with QSPI_CS0 --> Why CS0? // param = (MCF5XXX_QSPI_QDR_QSPI_CS0); // Works fine with QSPI_CS0 // // param = (MCF5XXX_QSPI_QDR_QSPI_CS2); // Not Working with QSPI_CS0. It's good. But, Not working with CS2 // param = (MCF5XXX_QSPI_QDR_QSPI_CS3); // Not Working with QSPI_CS0. It's good. But, Not working with CS3 // // param = (GPIO_PORT_QS | MCF5XXX_QSPI_QDR_QSPI_CS0); // Works fine with CS0. // param = (GPIO_PORT_QS | MCF5XXX_QSPI_QDR_QSPI_CS2); // Works fine with CS0. // if(ioctl(spi_fd, IO_IOCTL_SPI_SET_CS, ¶m) == SPI_OK) { TRACE(3, "IO_IOCTL_SPI_SET_CS----OK %d\n", param); } else { TRACE(3, "IO_IOCTL_SPI_SET_CS----ERROR %d\n", param); } // Set Baud rate param = 2000000; if (SPI_OK == ioctl (spi_fd, IO_IOCTL_SPI_SET_BAUD, ¶m)) { TRACE(3, "Changing the baud rate to %d Hz ... OK\n", param); } else { TRACE(3, "Changing the baud rate to %d Hz ... ERROR\n", param); } // Set Clock Mode param = SPI_CLK_POL_PHA_MODE0; if (SPI_OK == ioctl (spi_fd, IO_IOCTL_SPI_SET_MODE, ¶m)) { TRACE(3, "Setting clock mode to %d ... OK\n", param); } else { TRACE(3, "Setting clock mode to %d ... ERROR\n", param); } // Set Transfer Mode param = SPI_DEVICE_MASTER_MODE; if (SPI_OK == ioctl (spi_fd, IO_IOCTL_SPI_SET_TRANSFER_MODE, ¶m)) { TRACE(3, "Setting transfer mode to %d ... OK\n", param); } else { TRACE(3, "Setting transfer mode to %d ... ERROR\n", param); } // Write instruction result = fwrite(send_buffer, 1, 1, spi_fd); if(result != 1) { // Stop transfer TRACE(3, "First SPI Dev ... FAILED (1)!\n"); return status; } // Read SPI #1 status result = fread(&status, 1, 1, spi_fd); if(result != 1) { TRACE(3, "First SPI Dev status ... FAILED (2)!\n"); } else { TRACE(3, "First SPI Dev status ... OK ............ Status = 0x%02X\n", status); } // Wait till transfer end (and deactivate CS) fflush(spi_fd);