mmap write to AIPS 1 configuration causes program control loss

Discussion in 'UDOO NEO' started by laxmi, Mar 25, 2017.

  1. laxmi

    laxmi New Member

    Joined:
    Mar 25, 2017
    Messages:
    9
    Likes Received:
    1
    Hi,
    I am using UDOO Neo board. From A9 , I am trying to write to the AIPS 1 configuration register to give peripheral access to M4. Following is my piece of code which runs on A9. When I write a to virtual address returned by mmap the program control goes out of control. May I know why the control is getting lost?
    AIPS is located at 0x0207C000 with offset address 0x40000000

    #define AIPS_MODULE_1 0x4207C000

    virtual_addr = (uint32_t *)mmap(0,(getpagesize() * 1),PROT_READ|PROT_WRITE,MAP_SHARED,fd1,AIPS_MODULE_1);
    if(virtual_addr == (void *)-1)
    {
    printf("\n mmap fail %s\n", strerror(errno));
    }
    else
    {
    printf("\n AIPS_MODULE_1 Address %d\n", virtual_addr);
    }
    *virtual_addr=0x77777777;
    if((munmap((void *)virtual_addr, (getpagesize() * 250))) < 0)
    {
    printf("munmap failed AIPS_MODULE_1: %s\n", strerror(errno));
    exit(1);
    }
     
  2. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Not sure what your trying to achieve but on the A9 side AIPS 1 start/end is 0x02000000 to 0x020FFFFF see below:

    0200_0000 020F_FFFF 1 MB Table 2-3 AIPS-1. See IP listing on separate map.

    Code:
    #define AIPS_MODULE_1 0x4207C000
    
    So 0x4207C000 is out of range.

    Access to these memory region ideally should be done through a kernel driver.
     
  3. laxmi

    laxmi New Member

    Joined:
    Mar 25, 2017
    Messages:
    9
    Likes Received:
    1
  4. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Your getting confused the address range is 0x02000000 to 0x020FFFFF.

    If your new to linux then this may not a good exercise to start with, as launching M4 while running linux A9 has some (or many) pitfalls to overcome. You can launch the M4 from uboot which is easier to achieve.
     
    Last edited: Mar 26, 2017
  5. laxmi

    laxmi New Member

    Joined:
    Mar 25, 2017
    Messages:
    9
    Likes Received:
    1
    Hi Jas,

    Thank you for your valuable suggestions. Can you provide me the web link or some document on how to launch the M4 from Uboot?.
     
  6. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Links below may help, if your not understanding the terminology in the links then you will have a steep learning curve and this may not be productive.

    I.MX6SX M4 on U-Boot-FSLC
    IMX6SX problem running M4 and A9 both on DDR
     
  7. laxmi

    laxmi New Member

    Joined:
    Mar 25, 2017
    Messages:
    9
    Likes Received:
    1
    Ok!! Thanks for the links.
     
  8. laxmi

    laxmi New Member

    Joined:
    Mar 25, 2017
    Messages:
    9
    Likes Received:
    1
    Anybody have the success in programming the M4 using the Udoo's U-boot?
     

Share This Page