Author Topic: MCF52223 SPI: hangs on register access  (Read 8825 times)

Offline akorud

  • Newbie
  • *
  • Posts: 31
    • View Profile
MCF52223 SPI: hangs on register access
« on: December 17, 2008, 06:18:20 PM »
Hi,
I've just noticed that my MCF52223 hangs on any (read or write) access to QSPI registers (i.e. QMR, QAR). Compiled with CW7.1. Even tried access via *(IPSBAR + 0x340) - the same effect - immediate hang.
Any ideas anybody?

regards,
Andriy

P.S. I've even checked part type via CIR register - it's actually 52223, so SPI should be there. (Some times ago Freescale send us chips with wrong silicon inside).

P.P.S. But I can access (and read correct default values) that register with BDM ("Hardware diagnostics") in CW.
For example:
Code: [Select]
Read  0x0104 at address: 0x40000340
Read  0x0404 at address: 0x40000344
And compiler-generated instruction also look ok:
Code: [Select]
movew 40000340 <___IPSBAR+0x340>,%d0
« Last Edit: December 17, 2008, 06:40:34 PM by akorud »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: MCF52223 SPI: hangs on register access
« Reply #1 on: December 17, 2008, 06:38:48 PM »
Hi Andrij

Have you verified that the QSPI module is powered up?

See the following in M5223x.c:
    #if !defined SPI_INTERFACE && (defined SPI_FILE_SYSTEM || defined SPI_SW_UPLOAD)
    PPMRL = (CDUART0 | CDUART1 | CDUART2 | CDI2C | CDFEC0 | CDTMR0 | CDTMR1 | CDTMR2 | CDTMR3);
    #else
    PPMRL = (CDUART0 | CDUART1 | CDUART2 | CDI2C | CDFEC0 | CDTMR0 | CDTMR1 | CDTMR2 | CDTMR3 | CDQSPI);
    #endif


If SPI FLASH is not defined the default is powered down by default.

To power it up (before using) use POWER_UP(POWER_QSPI);

I am not absolutely sure, but accessing a powered down module may cause an exception.

Regards

Mark

Offline akorud

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: MCF52223 SPI: hangs on register access
« Reply #2 on: December 17, 2008, 06:43:37 PM »
Thanks Mark,
as usual you are right - that helped. I've not defined SPI_FILE_SYSTEM as I have my own device and need to find how to make your SPI code (I'm going to use SPI flash) with my own.

Thanks,
Andriy