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.

AM5728: I2C CSL example does not work on DSP - MMU/Firewall settings

Part Number: AM5728

Hi all,

In my system I have Linux running on MPU (both cores) and I want to write DSP application which talks to I2C gpio expander. I have tried example shipped with CLS but it seems that it does not work. In order to test PINMUX and hardware I used i2ctools package to test if I can communicate with expander on Linux - everything was working ok, I was able to read/write registers with 400ksps rate. Then on the Linux side I have modified dts to disable use of i2c4 bus and modified CSL example with correct base address of I2C4. I compiled bear-metal project with linker file used for CSL examples. Prorgram was loaded on DSP1 with JTAG (xds100v2). 

When I try to run the examplel code it hungs in SetupI2C() function on:

void SetupI2C(void)
{
    /* Do a software reset */
    I2CSoftReset(gI2cAddr);

    /* Enable i2c module */
    I2CMasterEnable(gI2cAddr);

    while (!I2CSystemStatusGet(gI2cAddr)) ;

    /* Put i2c in reset/disabled state */
    I2CMasterDisable(gI2cAddr);

I have checked if the previous function I2CMasterEnable() enables i2c module, but it seems it does not. When I check memory at offset 0xa4 I have only zeros.

I have following questions:

1. What I have to do in order to have access to I2C4 memory (0x4807_A000) from DSP1 core.  Shall I configure MMU/Firewall ? Can you provide detailed steps ?

2. If I2C4 code will work (in pooling mode) can I assume that the same code will work on M4 core ?

3. In my application I want to use GPIO3 interrupt (SYS/BIOS) . Do I need to configure IRQ crossbar ? Is it possible to have some minimal code for am5728 ?

 

Regards Grzegorz

 

 

  • After investigation I was able to find out that Linux kernel driver (remoteproc) is configuring DSP MMU to control regions which are accessed by DSP. 

    I have compiled DSP application with resource table from (ipc_3_50_04_07\packages\ti\ipc\remoteproc\rsc_table_vayu_dsp.h). According to header file the L4_PER1 ( 0x4800_0000 ) interconnect shall be mapped and accesible by DSP. But when load DSP application which read data from 0x4807_A000 address I get:

    [   89.790132] remoteproc remoteproc2: powering up 40800000.dsp
    [   89.977699] remoteproc remoteproc2: Booting fw image server_dsp1.xe66, size 4231348
    [   89.984334] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
    [   89.984365] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
    [   89.984434] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
    [   89.994594] ------------[ cut here ]------------
    [   89.994615] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x274/0x3a0
    [   89.994622] 44000000.ocp:L3 Custom Error: MASTER DSP1_MDMA TARGET L4_PER1_P3 (Read): Data Access in User mode during Functional access
    [   89.994627] Modules linked in:
    [   89.994639] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.108-ti-r122 #5
    [   89.994645] Hardware name: Generic DRA74X (Flattened Device Tree)
    [   89.994666] [<c01128dc>] (unwind_backtrace) from [<c010d798>] (show_stack+0x20/0x24)
    [   89.994680] [<c010d798>] (show_stack) from [<c0915788>] (dump_stack+0x80/0x94)
    [   89.994694] [<c0915788>] (dump_stack) from [<c013f394>] (__warn+0xf8/0x110)
    [   89.994707] [<c013f394>] (__warn) from [<c013f404>] (warn_slowpath_fmt+0x58/0x74)
    [   89.994717] [<c013f404>] (warn_slowpath_fmt) from [<c04f50e0>] (l3_interrupt_handler+0x274/0x3a0)
    [   89.994732] [<c04f50e0>] (l3_interrupt_handler) from [<c01a0980>] (__handle_irq_event_percpu+0x88/0x2cc)
    [   89.994742] [<c01a0980>] (__handle_irq_event_percpu) from [<c01a0c00>] (handle_irq_event_percpu+0x3c/0x8c)
    [   89.994751] [<c01a0c00>] (handle_irq_event_percpu) from [<c01a0c98>] (handle_irq_event+0x48/0x6c)
    [   89.994761] [<c01a0c98>] (handle_irq_event) from [<c01a4c44>] (handle_fasteoi_irq+0xc4/0x198)
    [   89.994771] [<c01a4c44>] (handle_fasteoi_irq) from [<c019fa6c>] (generic_handle_irq+0x34/0x44)
    [   89.994782] [<c019fa6c>] (generic_handle_irq) from [<c01a0080>] (__handle_domain_irq+0x8c/0xfc)
    [   89.994801] [<c01a0080>] (__handle_domain_irq) from [<c01015d0>] (gic_handle_irq+0x4c/0x88)
    [   89.994816] [<c01015d0>] (gic_handle_irq) from [<c0931a4c>] (__irq_svc+0x6c/0xa8)
    [   89.994823] Exception stack(0xc0f01ed0 to 0xc0f01f18)
    [   89.994830] 1ec0:                                     00000001 00000000 fe600000 00000000
    [   89.994839] 1ee0: ffffe000 c0f03e60 c0f03dfc 00000000 00000000 c0e9e8d0 c0bfab98 c0f01f2c
    [   89.994849] 1f00: c0f01f0c c0f01f20 c0130138 c01098c8 600e0013 ffffffff
    [   89.994865] [<c0931a4c>] (__irq_svc) from [<c01098c8>] (arch_cpu_idle+0x30/0x4c)
    [   89.994885] [<c01098c8>] (arch_cpu_idle) from [<c0930eac>] (default_idle_call+0x30/0x3c)
    [   89.994899] [<c0930eac>] (default_idle_call) from [<c018cd28>] (do_idle+0x1d4/0x1fc)
    [   89.994911] [<c018cd28>] (do_idle) from [<c018d05c>] (cpu_startup_entry+0x28/0x2c)
    [   89.994923] [<c018d05c>] (cpu_startup_entry) from [<c092a33c>] (rest_init+0xe0/0xe4)
    [   89.994935] [<c092a33c>] (rest_init) from [<c0e00e94>] (start_kernel+0x41c/0x444)
    [   89.994945] ---[ end trace 6f0d9115d33c2036 ]---
    [   89.997438] virtio_rpmsg_bus virtio0: rpmsg host is online
    [   89.997580] virtio_rpmsg_bus virtio0: creating channel rpmsg-proto addr 0x3d
    [   89.997773] remoteproc remoteproc2: registered virtio0 (type 7)
    [   89.997779] remoteproc remoteproc2: remote processor 40800000.dsp is now up

    I have checked with debugfs and it seems that this region is mapped :

    # cat resource_table
    Entry 0 is of type vdev
      ID 7
      Notify ID 0
      Device features 0x1
      Guest features 0x1
      Config length 0x0
      Status 0x7
      Number of vrings 2
      Reserved (should be zero) [0][0]

      Vring 0
        Device Address 0x99000000
        Alignment 4096
        Number of buffers 256
        Notify ID 0
        Physical Address 0x0

      Vring 1
        Device Address 0x99004000
        Alignment 4096
        Number of buffers 256
        Notify ID 1
        Physical Address 0x0

    Entry 1 is of type carveout
      Device Address 0x95000000
      Physical Address 0x99100000
      Length 0x100000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_MEM_TEXT

    Entry 2 is of type carveout
      Device Address 0x95100000
      Physical Address 0x99200000
      Length 0x100000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_MEM_DATA

    Entry 3 is of type carveout
      Device Address 0x95200000
      Physical Address 0x99300000
      Length 0x300000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_MEM_HEAP

    Entry 4 is of type carveout
      Device Address 0x9f000000
      Physical Address 0x99600000
      Length 0x100000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_MEM_IPC_DATA

    Entry 5 is of type trace
      Device Address 0x9f000000
      Length 0x8000 Bytes
      Reserved (should be zero) [0]
      Name trace:dsp

    Entry 6 is of type devmem
      Device Address 0xa0000000
      Physical Address 0x99000000
      Length 0x100000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_MEM_IPC_VRING

    Entry 7 is of type devmem
      Device Address 0x80000000
      Physical Address 0xba300000
      Length 0x5a00000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_MEM_IOBUFS

    Entry 8 is of type devmem
      Device Address 0x60000000
      Physical Address 0x60000000
      Length 0x10000000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_TILER_MODE_0_1

    Entry 9 is of type devmem
      Device Address 0x70000000
      Physical Address 0x70000000
      Length 0x8000000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_TILER_MODE_2

    Entry 10 is of type devmem
      Device Address 0x78000000
      Physical Address 0x78000000
      Length 0x8000000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_TILER_MODE_3

    Entry 11 is of type devmem
      Device Address 0x4a000000
      Physical Address 0x4a000000
      Length 0x1000000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_PERIPHERAL_L4CFG

    Entry 12 is of type devmem
      Device Address 0x48000000
      Physical Address 0x48000000
      Length 0x200000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_PERIPHERAL_L4PER1

    Entry 13 is of type devmem
      Device Address 0x48400000
      Physical Address 0x48400000
      Length 0x400000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_PERIPHERAL_L4PER2

    Entry 14 is of type devmem
      Device Address 0x48800000
      Physical Address 0x48800000
      Length 0x800000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_PERIPHERAL_L4PER3

    Entry 15 is of type devmem
      Device Address 0x54000000
      Physical Address 0x54000000
      Length 0x1000000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_PERIPHERAL_L4EMU

    Entry 16 is of type devmem
      Device Address 0x4e000000
      Physical Address 0x4e000000
      Length 0x100000 Bytes
      Flags 0x0
      Reserved (should be zero) [0]
      Name DSP_PERIPHERAL_DMM

    What is wrong with my setup ? Any suggestions ?

  • Grergorz,

    Can you try running the test bare metal without Linux initialization?  Pre-mmu setup etc.

    That may given an idea of where things went wrong.

    Regards,

    Kyle