I have an LP55S16 eval board. When I use the peripheral tool to configure CAN0, my project no longer builds as the SRAM usage goes to 113% versus 13% without the CAN implementation. I was expecting to see a 64KB buffer in the implementation, but did not. Does this have to do with the buffer alignment for CAN, which appears to be on a 64KB boundary? If so, how do I modify it in the peripheral tool? Or must I simply tweak a file by hand afterward?
On a related note, why does the linker configuration break things into 3 parts by default? They are SRAM,USB_RAM, and SRAMX (64 KB, 16KB, and 16KB). Making USB it's own area makes some sense, but I don't understand why SRAM and SRAMX weren't simply one contiguous space? Am I going to break any SDK generated code/examples if I start reallocating this?
So, I see another post for a different part which suggests this is a glitch and fixed in SDK 2.11:
https://community.nxp.com/t5/LPC-Microcontrollers/CAN-base-address-align-restriction-in-LPC55/m-p/13...
Can someone confirm that's true for my part, and comment on the question regarding the default linker configuration?
Thanks.
Hi,
Pls refer to the section 41.8.44 Message RAM base address register in UM11295.pdf.
The CAN message buffer requires that the low boundary address must be 0x1_0000, in other words, it is a 64KB block, but obviously, the CAN message does not need 64KB size.
In SDK, the line is used to allocate space for the CAN message buffer
#define CAN_MRBA_BA_SHIFT (16U)
SDK_ALIGN(uint8_t msgRam[MSG_RAM_SIZE], 1U << CAN_MRBA_BA_SHIFT) = {1U};
so the compiler will allocate 64KB space from 0xxxxx_0000 address boundary.
I also pasted the memory map of LPC551x, I think you can use the SRAM_0 as CAN message buiffer, which ranges from 0x2000_0000 0x2000_7FFF, but you do not allocate any variable to SRAM0 in *ld file.
In this way, you can use
CAN0->MRBA=0x2000_0000
it is okay. For the 32KB space, you can use pointer to access the remaining space except for the CAN message buffer.
Hope it can help you