I'm having problems getting the LPC1857 EMC configured for use with static peripherals (e.g. external UARTs with 8 or 16-bit wide parallel bus interfaces).
The write cycle configuration appears to work exactly as described in the LPC18xx user manual. However, the read cycle is usually (but not always) twice as long as I've configured. In addition, one or more address lines will change stage half-way through the "double-length" read cycle. The EMC appears to be attempting to read two adjacent addresses every time I do a single read.
The "double length" read doesn't occur all of the time. Perhaps 5% of the time, the read cycle will be the correct length and behave exactly as described in the user manual. AFAICT, whether I get a correct read cycle or a double-length read cycle is completely random. The exact same instruction reading the exact same address can generate a double-length read cycle one time through a loop and a correct read the next time.
I have disabled both page mode and buffering.
Reads are doubled both with and without "extended wait", and regardless of BLS configuration.
I've verified that the code is doing a single ldr.b instruction to read a peripheral register via an 8-bit wide chip select and an ldr.h instruction to read a peripheral register via a 16-bit wide chip select.
Since reading some peripheral registers has side effects (e.g. reading a data byte from a UART), it's not acceptable for the EMC to generate a spurious read from an address adjacent to the one I'm intending to read.
I've been fighting with this issue for a couple weeks now, and have been corresponding with our FAE, but have gotten nowhere.
If anybody has seen this issue (even if you don't know the solution) or has any ideas, please let me know.
Run your program in M0APP-core, I use LPC4337.
Firstly, thank you for your response. I would be interested in more detail, though. When it was decided not to carry that fix over into the LPC1800 product line, how was a user expected to connect an external periphal without the fix? Since it was fixed in the LPC1700 Cortex-M3 parts like the LPC1788, why not fix it in the LPC1800 Cortex-M3 parts?
This seems to be a problem that has been known about for a long time, is there an LPC1800 errata that describes it?
While this will hide the incrementing address bus lines from the peripheral, it won't prevent the doubling of the read cycle length will it? The long read cycle times may be a concern due to resource contention within the perpheral if the chip select is held too long.
We're currently testing a work-around where we configure the bus width to 2X the actual peripheral width and then always use accesses of 1/2 the bus width or smaller. For example, for a 16-bit peripheral we configure the bus width to 32, connect address lines starting with A2, and then use 16 and 8 bit accesses on 4-byte boundaries. This appears to prevent the double-length read cycles, but there is still a problem with the BLS lines: an 8-bit read still asserts multiple BLS lines when only one should be asserted. We may be able to live with the BLS problem.
For an 8-bit peripheral, we configure the bus width to 16 and then use only 8-bit accesses (on even addresses). Obviously the BLS problem doesn't affect 8-bit wide peripherals.
Can somebody from NXP confirm that this work-around should be reliable in preventing the doubling of the read cycle? I've asked our FAE, but he's been unable to provide any information or help on this problem. He wasn't able to even confirm there was a problem until I pointed out to him how it had been fixed in the LPC1700 family.
The one problem with either work-around is that it will reduce performance in the cases where we would normally use a 32-bit access to read two adjacent 16-bit registers (such an access allows us to dequeue 4 data bytes at a time rather than just 2).
Sorry if I was unclear. I'm not desiging a Cortex CPU core into something. I'm using an NXP LPC1800 uController. The external chip selects we are discussing are at addresses 0x1c000000, 0x1d000000, 0x1e000000, and 0x1f000000 -- I have no control over their location in the address map. In the LPC1800, the region 0xa000000 to 0xe0000000 is reserved and generates a fualt when accessed.
The problem appears to be the manner in which NXP has connected the EMC (external memory controller) IP block that they licensed from ARM. They fixed this problem in the older LPC1700 product line (which includes both ARM7 and Cortex parts), but inexplicably did not fix it in the newer LPC1800 family.
Does your book discuss features and problems specific to the NXP LPC1800 product line?
Without going into detail, I can only say that we have seen problems in previous MCU generations and we have done a patch on the memory interface IP block (coming from ARM). But unfortunately we did not take this patch over to the new Cortex generation.
A software/hardware workaround could be the following: connect the peripheral device to address lines A8 and higher. This requires absolute addressing in software, but in hardware it's a solution which does not affect the BOM.
Regards, NXP Technical Support