5282 problem with QSPI CLK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

5282 problem with QSPI CLK

3,355 Views
Mikeeulkeul
Contributor I
Hi all,
 
I use the QSPI of the MCF5282 and I've a problem to generate the clock.
I'm need to communicate with 4 CAN, and they need a low state for start a convertion on the Chip select
I was inspired of a source code of different solution on your forum.
 
Thanks for your help in advance.
 

/* Enable QSPI Pins Primary Functions */
 MCF5282_GPIO_PQSPAR = 0x7F;
 
/* set up delay from chip select to first edge of QSPI clock */ 
 MCF5282_QSPI_QMR=0xB302;
 MCF5282_QSPI_QDLYR=0x0000; 
 MCF5282_QSPI_QIR=0xD00F;
 MCF5282_QSPI_QIR |= MCF5282_QSPI_QIR_SPIF;  /* Make sure SPIF is cleared */
 
/* set queue pointer to the first command RAM entry */  
 MCF5282_QSPI_QAR=0x0020; 
 
/* command entry for transfer to QSPI_CS0 */
 MCF5282_QSPI_QDR=0x7E00; 
 MCF5282_QSPI_QDR=0x7E00;
 MCF5282_QSPI_QDR=0x7D00;
 MCF5282_QSPI_QDR=0x7D00;
 MCF5282_QSPI_QDR=0x7B00;
 MCF5282_QSPI_QDR=0x7B00;
 MCF5282_QSPI_QDR=0x7700;
 MCF5282_QSPI_QDR=0x7700;
 
/* set queue pointer to the first data RAM entry */
  MCF5282_QSPI_QAR = 0x0000; 
 
/* data RAM entry for transfer to QSPI_CS0 */
 MCF5282_QSPI_QDR=0xFFF;
 MCF5282_QSPI_QDR=0xFFF;
 MCF5282_QSPI_QDR=0xFFF;
 MCF5282_QSPI_QDR=0xFFF;
 MCF5282_QSPI_QDR=0xFFF;
 MCF5282_QSPI_QDR=0xFFF;
 MCF5282_QSPI_QDR=0xFFF;
 MCF5282_QSPI_QDR=0xFFF;
 
/* set up wrap register for 8 12-bit transfers */
 MCF5282_QSPI_QWR=0x0F00; 
 
/*start the transfer */
 MCF5282_QSPI_QDLYR |= MCF5282_QSPI_QDLYR_SPE;
 
while(!(MCF5282_QSPI_QIR & MCF5282_QSPI_QIR_SPIF)){} // Wait till transfers are complete
MCF5282_QSPI_QAR=0x0010;     //Receive RAM selected
DATA = MCF5282_QSPI_QDR;
 
Labels (1)
0 Kudos
Reply
3 Replies

1,266 Views
Pai
Contributor I
Hi, In QWR register, set bit CSIV to 1 if you need chip select as active low; also set correctly the length of the queue: you want 8 transfers and set instead ENDQP to 'F' (16 transfers). Regards, yoan
0 Kudos
Reply

1,266 Views
Mikeeulkeul
Contributor I
Ok, thanks yoan.
But then I look my QSPI_CLK output, I don't see the QSPI Clock.
I don't know if my clock is correctly generated, but I see the QSPI_CLK with an oscilloscope I've a constant signal.
 
Regards.
0 Kudos
Reply

1,266 Views
GUNNM
Contributor I
YOU must set  your pin in input or in output as this register:

MCF_GPIO_DDRQS = (0
            | MCF_GPIO_DDRQS_DDRQS0
            | MCF_GPIO_DDRQS_DDRQS3
            | MCF_GPIO_DDRQS_DDRQS2);

I have a coldfire 52233 but i think that your register is the same.



0 Kudos
Reply