Hi,
I am trying to detect the lenght of a SPI chain. Therefore it necessary to write in the chain at first an amount of Bytes with the value "0", after that known numbers. Then I am waiting till i receive my known number.
I give to the SPI function every time one Byte and send it to the chain. After that I am leaving the function and compare the result with my known number outside the SPI function.
There is only one problem: The Chip-Select Signals changes every time I sent one Byte.
How can I configure the QSPI in that way, that the Chip-Select Signals will memorize their value. (don´t disable the chain)?
regards, Stefan
已解决! 转到解答。
Hi Rich,
many thanks for the answer. You´re right, thats the solution. I´d tried it this morning and it works fine. Now the ChipSelect signals are configured as GPIO and set just before using the QSPI.
I am working with an Coldfire V2 CPU (MCF5223X).
Have a nice day.
regards, Stefan
What MCU are you using? If it is CF V2, what I have done is default the QSPI_CS0 (or whatever) pin to its primary function, which will have it be asserted for each transfer, independently and automatically, by my QSPI library (you can see my library in sources/qspi.c at http://www.cpustick.com/downloads/skeleton.zip).
This works fine for most "fixed length transfer" peripherals, like EzPort or MC1320x wireless transceivers.
However, if I am talking to a SPI device like an SD card, where I need "variable" length transfers, based on interpretation of the data being transferred on the fly, I simply reprogram the QSPI_CS0 pin to GPIO mode (quaternary function) and control it by asserting it by hand, calling qspi_transfer() from my library multiple times, and then deasserting it.
Would that work for you?
You can also play with the "chip select inactive value" between transfers and spoof the assertion/deassertion, but my experience has been once I get to something more complicated than just "assert during the single transfer" (from the inner loop), it becomes easier to reprogram the pin to GPIO mode and control it by hand, in an outer loop.
-- Rich
Hi Rich,
many thanks for the answer. You´re right, thats the solution. I´d tried it this morning and it works fine. Now the ChipSelect signals are configured as GPIO and set just before using the QSPI.
I am working with an Coldfire V2 CPU (MCF5223X).
Have a nice day.
regards, Stefan