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.

AM335x EDMA transfer state / timestamp

Other Parts Discussed in Thread: AM3359

Hi all,

We use a phytec product : Phycore AM335x with am3359 Processor.

We have generate the linux BSP with Buildroot 05.2013 and the patch from phytec :

ftp://ftp.phytec.de/pub/Products/phyCORE-AM335x/Linux/PD13.1.2/

Linux kernel 3.2

I have 2 questions about the AM335x :

Question 1:

I use a peripheral event to do EDMA tranfer.

I use EDMA to avoid interrupt on each peripheral event.

My problem is :if I receive only 3 events and I need 5 events to have a DMA complete :

How can I know that 3 events has already occurs and that the data are in the destination buffer without activating the interrupt?

Question 2:

When the peripheral event occur, I want to get a time stamp.

I don't want to do this with interrupt, because the goal of use of edma is to avoid interrupt on each peripheral event.

I can us a chained event, but I don't know what I can use as source adress for the second slot ?

Have someone any idea ?

Best regards,

Catherine

  • Hi Catherine,

    Is this related to the CAN question you posted some time ago. If it is you already received feedback from the factory team on this issue:

    "The core driver code for the can interface was not written by TI, the core used in the SOC was licensed from Bosch and was written by Bosch representatives. TI cannot comment at this time on the feasibility of adding DMA support since the core code does not implement a DMA feature."

  • Hi Biser,

    Yes it is the next step for my own CAN kernel driver.

    I know that the D-CAN don't support DMA, but I write my own driver with DMA and it works : I have found the issue on my last question.(see the other post !)

    But this new post is general to edma use with peripheral event. Not only for CAN !

    regards

    Catherine

  • You can use a free-running timer as the source of the time stamp DMA transfer. You may use the linux system timer for that.

    You may also use another chained DMA transfer to mark a buffer as "full".

    regards

    Wolfgang

  • Hi Wolfgang,

    >>You can use a free-running timer as the source of the time stamp DMA transfer. You may use the linux system

    >>timer for that.

    -> On which address can I access this timer ? I must give the physical address on the edma paramset.

    What do you mean with "You may also use another chained DMA transfer to mark a buffer as "full"." ?

    -> You mean that this will generate an interrupt and call the callback to that I can read the linux timer ?

    Thanks

    Regards

    Catherine

  • I think the system timer is timer 1. You can check this with "cat /proc/interrupts" and have a look at the interrupt number.

    The physical address of the timer register is in the AM335x user manual.

    Marking a buffer as "full":

    struct buffer {

    int timestamp;

    int flag;

    char data[xx];

    };


    flag_dma_buffer[0] = 1;

    dmachannel.source = dma_addr(flag_dma_buffer);

    dmachannel.dest = dma_addr(buffer.flag);

    "After filling the buffer with data, and after filling the buffer timestamp with the timer value, do a DMA transfer to set the flag in the buffer to 1."

    regards

    Wolfgang

  • I will try it !!!

    Thank You Wolfgang !

    regards,

    Catherine

  • Hi,

    I have another question about the timestamp :

    >>You can use a free-running timer as the source of the time stamp DMA transfer.

    >>You may use the linux system timer for that.

    >> I think the system timer is timer 1. You can check this with "cat /proc/interrupts" and have a look at the interrupt number.

    The interrupt is the 68 -> it means DMTimer 2 is used as system timer.

    I need a time stamp with a resolution from approximatively 1 us. I do some test with DMTimer3 and it works but I have the following question :

    The DMTimer3 work with a clock from 25MHz. I must be sure that this clock and the system clock are synchronise.

    (Because I want return a timestamp since Epoch with the CAN Message received)

    How can I find how the DMTimer2 system timer is initialised (which clock it use and the resolution of the timer)?

    Regards,

    Catherine

  • Using "absolute" times is a problem by itself.

    Your driver will be better if, at regular time intervals, you do

    a) request the system time (gettimeofday)

    b) readout the timer value:

    unsigned int start_time = timervalue.

    And for each buffer processing:

    unsigned int timediff = (buffer.timerval - start_time);

    time = stored time of day + timediff.

    regards

    Wolfgang

  • Hi Wolfgang,

    Thank you for your help.

    I still want know which of clock is used for the system time.

    This is to know if the different timer run with the same clock or not.

    Your solution will work, but I need to save a lot of information for each CAN messages.

    If there is a possibility to avoid that ...

    regards

    Catherine

  • Hi,

    I have a problem with the dm timer:

    I use the dm timer 3 and initialise it with a value to have an overflow interrupt each second.

    The first time I load my kernel driver after the boot, I don't receive any error from the omap_dm_timer_* functions, and I don't receive any interrupt.

    The interrupt function is installed because I can see it by cat /proc/interrupts.

    When I unload the kernel driver(stop and free and deinstall interrupt routine) and reload it, then I become the interrupt !

    I have try the following : Init the timer, deinitialise it and reinit the timer by the load of my kernel driver and it works ...

    Have someone any idea ?

    Thanks,

    Catherine