Strange thing about the QSPI module in MCF5235

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

Strange thing about the QSPI module in MCF5235

4,059 Views
Ivychacha
Contributor I
Hi all,

I'm trying to connect a spi-eeprom with the qspi module to the MCF5235. I wrote some code with the read/write functions which doesn't work correctly. When I did the step by step with BDM, I found a strange thing, that is the QAR is incremented by 2 at each write to QDR, that means:

MCF_QSPI_QAR = 0x20; // set QAR to command RAM zone
MCF_QSPI_QDR = 0xC200;

when I've passed the second line, QAR becomes 0x0022, so that I've got only 8 commands available instead of 16.

Is that because of the definition:
#define MCF_QSPI_QAR (*(vuint16*)(void*)(&__IPSBAR[0x000350])) ?

How can I fix this problem?

It's perhaps a stupid question but I wish someone could answer me, thanks a lot.

--
Ivy
Labels (1)
0 Kudos
Reply
8 Replies

1,379 Views
Ivychacha
Contributor I
i'll resume the answer of my own question:

it's not a good idea to work with the spi without a scope :smileyvery-happy: because the register view gives an extra access to the QDR and that disturbes the program running normally.

also, we can't see what's inside the QCR because it's not readable by the user (thanks arev).

so the best way: get a scope :smileyvery-happy:

i'll put here my code, it's for the spi-eeprom st95640w. hope it will help those who need.
0 Kudos
Reply

1,379 Views
Ivychacha
Contributor I
To correct what I've said, now I manage to view something other than 0 in the command RAM registers, but instead of what I've put with QDR, I got somme 0xFF.
0 Kudos
Reply

1,379 Views
Arev
Contributor III
Hello,
 
For information,
 
QSPI Transmit RAM (0x00-0x0F) is WRITE ONLY,
QSPI Receive RAM (0x10-0x1F) is READ ONLY,
QSPI Command RAM (0x20-0x2F) is WRITE ONLY.
 
Bye
 
0 Kudos
Reply

1,379 Views
stzari
Contributor III
Hi Ivy,

I can't reproduce this behaviour on my system - at least not when running through the code.

There is one possibility however to reproduce this within the debugger : If you have a register view of QDR open, then with each step (as this view is refreshed) you get an additional access to QDR thus incrementing QAR.

HTH
stzari
0 Kudos
Reply

1,379 Views
Ivychacha
Contributor I
PS. Another thing, is it normal that in 'register view' I've got the QDR always = 0 ? It aut-clear itself after putting the data into the QSPI RAM?

thanks.

--
Ivy
0 Kudos
Reply

1,379 Views
stzari
Contributor III
Hi Ivy,

Since the register view of QDR always accesses the next RAM position (since QAR has been incremented by the last access to QDR) I would guess that a readout of 0 would be ok.
Note that you would always write to even addresses while the register view would read the contents of odd addresses in the QSPI RAM.

If you really need to know the contents of the QSPI RAM I would suggest the following (haven't tried it since I brought up my module with a scope and a lot of printf's ... Smiley Happy

my_qspiram_readfunction()
{
  U16 ram[RAM_LENGTH];
  U16 save_qar;

  save_qar = QAR;
  QAR      = 0x20;
  for(i=0; i .LT. 0x10; ++i) ram[i] = QDR;
  QAR      = save_QAR;
}


You could then insert this function wherever you want to know the contents of the QSPI RAM.
HTH
stzari
0 Kudos
Reply

1,379 Views
Ivychacha
Contributor I
Hi stzari,

Thank you for your answer, I've tried your function but I've got only zeros...that means I haven't written in the command RAM registers at all :smileysad:

I'll put my function here perhaps there's something that is missing.
0 Kudos
Reply

1,379 Views
Ivychacha
Contributor I
Thank stzari for your answer, I think that's the problem. But without the register view I can't know what happens inside the QSPI module... is there any other way to be aware of what happens in each step?

Thanks very much.

---
Ivy
0 Kudos
Reply