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.

RTOS/AM3358: Profibus Master and Ethernet

Expert 2730 points

Part Number: AM3358
Other Parts Discussed in Thread: PROFIBUS, TMDSICE3359

Tool/software: TI-RTOS

I have Profibus master working (the demo stack and as a slave I have the TMDSICE3359). Also the networking works. But if I combine this two I have a problem. As long as I don't have traffic on ethernet the profibus communication works. If I add the ethernet communication the profibus communication will stop after few seconds. The slave doesn't get any packages, but the master stack thinks that the communication is still ok. The master stack returns connected status with the GetStatus() function. It doesn't matter if I remove the cable or switch off the slave, the Profibus master stack still returns connected status for the slave. I guess it has to be some kind of timing problem, but I just don't know where to search because I don't have the source code of the profibus master library.

I'm using PDK 1.0.7 and Profibus Master 1.00.1.1

The profibus loop has the priority of 4, and If I set it higher then the ethernet doesn't work and software will crash because hwi 41 (CPSW (Ethernet) c0_rx_pend) is not implemented or something like that. The tasks which uses ethernet, which I have two, both have priority of 1.

Any ideas where I could search the failure or how should I set the priorities for the tasks?

The Profibus master has also another bug. I can't stop the stack with ResetBoard();, because ThreadDPMasterProxy is still running and the function tries to delete the task which is not allowed while task is in running state and the program will crash.

Edit: 

Extra question. Why doesn't profibus master work when cache is enabled?

JHi

  • The RTOS team have been notified. They will respond here.
  • What I just noticed is, it doesn't matter how I set my network task priorities, because it is enough to stop the profibus master to work correctly by sending ping with 0.2s intervals.
  • JHi,

    >>Why doesn't profibus master work when cache is enabled?

    You may refer to the reference design - Industrial Communications Gateway PROFINET® IRT to PROFIBUS® Reference Design ().

    PROFIBUS requires 1MB memory DDR region to be uncached for PRU driver memory mapping. The DDR memory cache-ability is configured in .cfg file, where several memory sections with various cache-ability attributes will be defined. So you can enable the cache but keep the 1MB for PROFIBUS in un-cached section, e.g. update the starting address from default 0x8200_0000 to 0x9200_0000 as below in SwPruss.c.

    int PRUSSDRVMapExtMem(void **address)
    {
    *address = (void *)0x92000000;
    return 0;

    }

    The following is the code snippet for uncached DDR memory region:

    Mmu.initDescAttrsMeta(attrs0);

    attrs0.type = Mmu.DescriptorType_BLOCK; // BLOCK descriptor

    attrs0.shareable = 2; // shareable

    attrs0.attrIndx = 1; // Non-cache, device memory

    // Set the descriptor for each entry in the address range

    for (var i = 0x90000000; i < 0xA0000000; i = i + 0x00200000) {

    // Each 'BLOCK' descriptor entry spans a 2MB address range

    Mmu.setSecondLevelDescMeta(i, i, attrs0);

    }

    >>The profibus loop has the priority of 4, and If I set it higher then the ethernet doesn't work and software will crash because hwi 41 (CPSW (Ethernet) c0_rx_pend) is not implemented or something like that. The tasks which uses ethernet, which I have two, both have priority of 1.

    In addition to your ethernet applications tasks, there are some NDK tasks underneath, which typically have low/normal/high/kernel level priority NDK tasks 3/5/7/11. You may run into issue if setting other tasks .e.g profibus loop higher than NDK normal level.

    Can you try to update the hard-coded memory address 0x8200_0000 to 0x9200_0000 in Profibus as noted above to see if it help resolve any memory access conflict between your Ethernet application and Profibus?

    Regards, Garrett

  • Thanks for the answer. I will be next few days on vacation and I will try this next week and report the results.

    JHi

  • Thanks for the hint. Your solution is actually for the AM572x and doesn't work as such for the AM335x.  Here is what worked for me:

    - As I only have 256MB DDR, I had to change the address in SwPruss.c ( I left actually 2MB)

    int PRUSSDRVMapExtMem(void **address)
    {
        *address = (void *)0x8FE00000;
        return 0;
    
    }

    Then for the .cfg

    // descriptor attribute structure
    var DDR3_Attrs = {
        type: Mmu.FirstLevelDesc_SECTION,  // SECTION descriptor
        tex: 0x1,
        bufferable: true,                  // bufferable
        cacheable: true,                   // cacheable
    };
    
    // Set the descriptor for each entry in the address range
    for (var i=0x80000000; i < 0x8fe00000; i = i + 0x00100000) {
        // Each 'SECTION' descriptor entry spans a 1MB address range
        Mmu.setFirstLevelDescMeta(i, i, DDR3_Attrs);
    }
    
    var DDR3_Profibus = {
    	type: Mmu.FirstLevelDesc_SECTION,  // SECTION descriptor
        tex: 0x1,
        cacheable: false,                   // cacheable
        shareable : true, 					// shareable
    };
    
    // Set the descriptor for each entry in the address range
    for (var i=0x8fe00000; i < 0x90000000; i = i + 0x00100000) {
        // Each 'SECTION' descriptor entry spans a 1MB address range
        Mmu.setFirstLevelDescMeta(i, i, DDR3_Profibus);
    }
    

    I still have problem that I can't reconfigure the master because the Profibus stack wants to delete a running process which is not allowed. Is there an easy way to make a reset? RTOS doesn't have any reset command.

    JHi