Disabling BDM interface on MCF5484

I would like to turn off the PSTDDATA[7..0] and PSTCLK lines to reduce EMI emission of my device.To turn these off, I know you can execute WDEBUG command to set the PCD bit of CSR register but I don't know how to do that.

Please, do you know if there is a convenient flag to set in Linux Kernel configuration ?

> Where should I put that code - which file (maybe mcf532x_lo.s) or other place ?

I don't know what OS or source code base you're using so I can't give a precise answer. You may be running code based on whatever CodeWarrior or one of the other Freescale software products. We're not.

It doesn't matter where this code is, as long as it gets executed somewhere at startup.

Depending on your system, it might be easier to add it to the lowest-level startup code, just after the chip selects, SDRAM and I/O pins have been set up. Or you might create an assembly function that can be called from some C code if that makes more sense for your design.

Do you have separate Bootstrap and Application code?

How are you going to handle running the code under the debugger? The way we do it here is to have the Bootstrap in FLASH set up the chip selects and the SDRAM controller, set up the Watchdog, disable the Debug pins and then copy itself to RAM. When running under the debugger, we load the Bootstrap into the normal target SDRAM location and run it from there. The code "knows" when it has started from SDRAM (by checking its program counter) and bypasses the SDRAM setup, Debug disabling, and programs the Watchdog differently so it pauses when the debugger stops the code.

I've been thinking about your problem. You didn't say that adding the "wdebug()" has CAUSED the "exception" problem, but I'm guessing it has.

So if you remove the "wdebug" the problem goes away?

That makes debugging very simple as we know exactly where the problem is - with the debug.

Assuming you know nothing about assembly coding and have just dropped the "wdebug" into the middle of some other code, there are two things that you might have got wrong.

Firstly, the syntax of the wdebug instruction from CFPRM>PDF is "WDEBUG.L <ea>y". In the example I gave it is using an address register to point to the debug data. So you have to select a register to use that is not being used for anything else in the code at the point where you added the instruction. So it is possible that the code is doing something like:

If that is what has happened you should choose a different register that is not currently in use to replace "a0" in the added wdebug code, or move the code somewhere else.

The other possibility is that you've dropped the "debug data" into the middle of the code. Assembly isn't like "C", where the compiler knows that something like "int nValue" is a declaration of a variable. So if you put the "debug:" and the "wdebug" in line and next to each other it would result in the CPU is trying to execute the 0x2c80, 0x0002, 0x0000, 0x0000" data as instructions. That would be interpreted as "move.l d0, (d6)" followed by 3 unassigned instructions, which would trigger an illegal instruction exception. Is that what you did? If so, move the "debug:" data up higher in the file to where other data is being declared, and before where the code starts.