RAM shoots up with usage of mcan module

cancel
Showing results for 
Search instead for 
Did you mean: 

RAM shoots up with usage of mcan module

457 Views
hemanthvasista
Contributor IV

Hello ,

I am using LPC54606 controller with CAN and other peripherals.

I have configured CAN to transmit 9 frames and receive 5 frames. The transmission and reception seems to be fine.

But the RAM consumption shoots up when I use CAN module.

If I disable the CAN module, the RAM consumption reduces by ~65%

Memory region                  Used Size     Region Size     %age Used
   PROGRAM_FLASH:     32832 B          256 KB           12.52%
      SRAM_UPPER:           9296 B           96 KB            9.46%
           SRAMX:                   0 GB              32 KB            0.00%
         USB_RAM:                0 GB               8 KB             0.00%

The above is summary from map file without CAN module

Memory region                  Used Size     Region Size     %age Used
   PROGRAM_FLASH:      33168 B       256 KB              12.65%
      SRAM_UPPER:          75072 B        96 KB               76.37%
           SRAMX:                   0 GB           32 KB               0.00%
         USB_RAM:                0 GB            8 KB                0.00%

The above is summary from map file with CAN module

I have few questions:

1. Is the usage summary shown in the Console(after build) correct?

2. When I comment the CAN RAM initialization, the RAM consumption drops

    /* Message RAM initialization */
    //memset(CAN1_RAM_BASE_ADDRESS, 0,CAN1_MESSAGE_RAM_SIZE * sizeof(uint32_t));
    //MCAN_SetMsgRAMBase(CAN1, (uint32_t)CAN1_RAM_BASE_ADDRESS);

How do I calculate the actual RAM consumption?

regards,

Hemanth

Labels (1)
Tags (2)
0 Kudos
4 Replies

390 Views
hemanthvasista
Contributor IV

Yes, ideally the *.map file would give the exact resource consumption.

The summary shown in console give the actual resource consumption.

text data bss dec hex filename
66140 3476 10600 80216 13958 LPC54606J256_Project.axf

The percentage value shown in build summary for the RAM is erroneous.

The CAN ram allocation are part of SRAM1. The percentage RAM consumption summary consider SRAM0 + SRAM1, even though SRAM0 is not yet fully utilized. This was the reason for the inflated values.

 

regards,

Hemanth

 

0 Kudos

420 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

Yes, about detail you can refer to  " Memory Usage" and "Memory Contents" in MCUXpresso IDE,

refer to 17.6.1 and 17.6.2 of <MCUXpresso_IDE_User_Guide.pdf>. 

I also attached it for you.

Regards,

Alice

0 Kudos

420 Views
hemanthvasista
Contributor IV

Hello Alice,

Thanks for the info.

But the RAM consumption shown after build in Console is different from that of the Shown in Memory view(for build axf file)

CONSOLE_READ.jpg

Above is the Console View

AXF_READ.jpg

Above is the Memory View

The above snapshot are for the same binary built.

So this looks like some issue in console summary display.

regards,

Hemanth

0 Kudos

420 Views
converse
Senior Contributor V

The best way to find out where the memory is being used, is to look in the .map file produced by the linker. From you description, it looks like there are some large buffers being allocated.

0 Kudos