This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Appro DM368-IPNC cmem issues

Hi,

i am facing the following errors on running av_server.

# ./av_server.out D1

AVSERVER UI: Initializing.
 AVSERVER API: Creating TSKs.
CMEMK Error: ioctl: failed to allocate heap buffer of size 0x19ae84
 
 CLK Hz,
 ARM   Hz =  432000000
 DDR   Hz =  340000000
 VPSS  Hz =  340000000
 IMCOP Hz =  340000000
 
CMEM Error: allocHeap: ioctl CMEM_IOCALLOCHEAP failed: -1
 DRV LDC: GetConfig 0003 0x0
CMEMK Error: ioctl: failed to allocate heap buffer of size 0x363000

 AVSERVER API: Creating TSKs...DONE

CONFIGURING AVSERVER FOR DM365 .....
queue id:65538
 AVSERVER API: Sending START.
 AVSERVER MAIN: Recevied CMD = 0x0400, state = 0x0000
 AVSERVER MAIN: AVSERVER_tskConnectInit() ...
 AVSERVER MAIN: Create captureTsk ...
 CAPTURE: Recevied CMD = 0x0300
 CAPTURE: Create...
 CAPTURE: Opening capture on imager IMX036_3MP.
 CAPTURE: Opening imager IMX036_3MP.
############OPEN###########
==========>>>> Start X,Y = 52,18
 Sensor Mode Info,
 Width      = 1736
 Height     = 1124
 fps        =   30
 Bin Enable =    1
 
 Sensor Frame Timing Info,
 fps                  = 30
 t_frame (ns)         = 33333334.000000
 t_row   (ns)         = 27458.333984
 t_pclk  (ns)         = 10.416667
 W                    = 1736
 H                    = 1124
 SW                   = 1125
 SD                   = 0
 HB                   = 450
 VB                   = 89
 HBmin                = 450
 VBmin                = 9
 f_pclk               = 96000000
 shutterOverhead (ns) = 4437.500000
 col_size             = 1736
 row_size             = 1124
 col_bin              = 0
 row_bin              = 0
 col_start            = 232
 row_start            = 348
 pll_M                = 16
 pll_N                = 1
 pll_DIV              = 1
 
############reset###########
############SPI OPEN###########
spi mode: 16
bits per word: 8
max speed: 12000000 Hz (12000 KHz)
############SET REG###########
############OPEN END###########
 CAPTURE: Opening ISIF.
CMEM Error: allocHeap: ioctl CMEM_IOCALLOCHEAP failed: -1
 ERROR  (drv_isif.c|DRV_isifOpen|92): OSA_cmemAlloc()
 ERROR  (drv_capture.c|DRV_captureOpen|63): Open failed
 ERROR  (videoCaptureThr.c|VIDEO_captureTskCreate|85): DRV_captureOpen()
 ERROR  (videoCaptureThr.c|VIDEO_captureTskMain|688):

VIDEO_captureTskCreate() ERROR  (avServerMainThr.c|AVSERVER_tskStart|
24):
Unknown message. Quit
Recieved Quit event
Kill queue id:65538
Kill queue id:98307
Kill queue id:32769
Error File Receive msg fail
Error File Receive msg fail
Error File Receive msg fail
Error File Receive msg fail
msgrcv ERROR: Invalid argument
Kill queue id:32769
Creat queue id:131073
queue id:131073
Alarm Receive msg fail
Kill queue id:65538
Kill queue id:98307

i am facing cmem issues:

The insmod i am using to allocate cmem memory is as follows:
insmod cmemk.ko phys_start=0x85000000 phys_end=0x88000000
pools=6x4096,2x8192,1x11908,2x13184,1x2697152,6x4096,1x30720,3x81920,1x3185664,64x56,1x320,1x640,1x81920,1x6650880,2x608,1x296,1x28,2x24,23x1548288,1x154288 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672c allowOverlap=1 useHeapIfPoolUnavailable=1

also i have tried following combinations but none is working:

insmod cmemk.ko phys_start=0x85000000 phys_end=0x88000000 pools=6x4096,2x8192,1x11908,2x13184,1x2697152,6x4096,1x30720,3x81920,1x3185664,64x56,1x320,1x640,1x81920,1x6650880,2x608,1x296,1x28,2x24,23x1548288,1x154288 phys_start_1=0x00001000 phys_end_1=0x00500000 pools_1=1x400000c allowOverlap=1 useHeapIfPoolUnavailable=1

insmod cmemk.ko phys_start=0x84c00000 phys_end=0x88000000 pools=8x4667200 useHeapIfPoolUnavailable=1



All are leading to one or the other cmem error.

My doubts:
1.I am still not able to calculate how i can give sufficient memory to
cmem so that i can be able to run ipnc application.Is there any method
to do this:
2.Also if you could tell me your insmod command so that i can be able to
run ipnc application fine.
3.Does enabling the debug info leads to higher memory requirements from
cmem.

Thanks and Regards,
Mayank

  • Mayank Agarwal said:
    1.I am still not able to calculate how i can give sufficient memory to
    cmem so that i can be able to run ipnc application.Is there any method
    to do this:

    The way to track CMEM memory usage is to turn on debug output.  Here's a link to how to turn on user-level debug output: http://processors.wiki.ti.com/index.php/CMEM_Overview#Debugging_Techniques.  You can turn on kernel module output by doing "make debug" in the kernel module directory <linuxutils>/ti/sdo/linuxutils/cmem/src/module.

    With the CMEM debug output you can "track" all allocations and frees, keeping a running total for what you need at any given time.  It's crude, but effective.

    Mayank Agarwal said:
    insmod cmemk.ko phys_start=0x84c00000 phys_end=0x88000000 pools=8x4667200 useHeapIfPoolUnavailable=1

    The above configuration is not going to do very well, since pool-based allocations will use any "big enough" pool, so your 8 buffers of size 4667200 might get consumed by very small buffer allocations (and wasting precious CMEM memory), leaving only the heap to satisfy the big allocations.

    A common method during development is to have CMEM memory be all heap, which is accomplished by not specifying "pools=", along with having "useHeapIfPoolUnavailable=1":
        % insmod cmemk.ko phys_start=0x84c00000 phys_end=0x88000000 useHeapIfPoolUnavailable=1
    In this way, all pool-based requests will fallback to the heap, and the heap allocations will be sized efficiently (with allocations rounded up to the nearest PAGE_SIZE of 4 KB).  When doing so and having debug info enabled, you can track all allocations for the life of the app.  Once you know all allocation requests you can reduce CMEM memory to what is needed and construct pools according to the app needs (and you probably want pools instead of heap to avoid heap fragmentation issues).

    Mayank Agarwal said:
    insmod cmemk.ko phys_start=0x85000000 phys_end=0x88000000
    pools=6x4096,2x8192,1x11908,2x13184,1x2697152,6x4096,1x30720,3x81920,1x3185664,64x56,1x320,1x640,1x81920,1x6650880,2x608,1x296,1x28,2x24,23x1548288,1x154288 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672c allowOverlap=1 useHeapIfPoolUnavailable=1

    Mayank Agarwal said:
    insmod cmemk.ko phys_start=0x85000000 phys_end=0x88000000 pools=6x4096,2x8192,1x11908,2x13184,1x2697152,6x4096,1x30720,3x81920,1x3185664,64x56,1x320,1x640,1x81920,1x6650880,2x608,1x296,1x28,2x24,23x1548288,1x154288 phys_start_1=0x00001000 phys_end_1=0x00500000 pools_1=1x400000c allowOverlap=1 useHeapIfPoolUnavailable=1

    I'm wondering what memory you're trying to use with your "_1" specifications.  The size of the "pools_1" needs to be <= (phys_end_1 - phys_start_1).  Both examples I quote above have a pools_1 size > the amount of memory specified with phys_start_1/phys_end_1.

    Mayank Agarwal said:
    3.Does enabling the debug info leads to higher memory requirements from
    cmem.

    No, not as far as the phys_start/phys_end block (but more mem for application since it has printfs).

    Regards,

    - Rob