+ Reply to Thread
Results 1 to 7 of 7

Thread: Modbus TCP without RTOS

  1. #1
    New Member New Member Koumak is on a distinguished road
    Join Date
    Feb 2013
    Posts
    75
    Points
    45.80078125

    Modbus TCP without RTOS

    Hello,

    Is there a way to use Modbus TCP without RTOS? (for XMC4700)
    Please, all advices are welcome.

    I also asked here:
    https://www.infineonforums.com/threads/4498-Modbus-TCP

    Regards,
    Koumak

  2. #2

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    689
    Hi,

    See attached project.
    Basically the ETH_LWIP APP allows you to choose whether to use RTOS or non RTOS. One selected non RTOS and code being generated, it is needed to replace all threads by software timers.

    Regards,
    Jesus
    ?????
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  3. #3
    New Member New Member Koumak is on a distinguished road
    Join Date
    Feb 2013
    Posts
    75
    Points
    45.80078125
    Jesus,

    Thank you very much.
    Now it works

    Regards,
    Koumak

  4. #4
    Beginner Beginner David King is on a distinguished road
    Join Date
    Feb 2017
    Posts
    76
    Points
    470
    Hi Jesus. I'm trying out 'MODBUS_TCP_MODE_NOOS_XMC47.zip'. Main has just the following while loop:

    while(1)
    {
    sys_check_timeouts();
    }

    sys_check_timeout() normally takes microseconds to run.
    But I've noticed that sys_check_timeouts() takes a whole 2 seconds to run, about a second after the while loop starts running.
    Is this normal?
    Can it be avoided?
    Can it occur at other times, apart from a second after the while loop starts running.
    The 2 second 'hang' in sys_check_timeouts(), will prevent other actions I want to perform within the while-loop, from being performed.

    I found out this 2 second 'hang' was occurring, by turning an LED off just before the sys_check_timeouts() call, and turning it back on after
    Most of the time, the LED just glows half-brightness, showing it's being turned on and off very rapidly.
    But for the 2 second period mentioned, the LED goes off completely.

    If I pause during the 2 second period, the debugger shows the code is within the following retry loop,
    XMC_ETH_MAC_PHY_MAX_RETRIES being set to 65535 iterations!

    :
    /* Read physical layer and obtain status */
    XMC_ETH_MAC_STATUS_t XMC_ETH_MAC_ReadPhy(XMC_ETH_MAC_t *eth_mac, uint8_t phy_addr, uint8_t reg_addr, uint16_t *data)
    {
    uint32_t retries;
    :
    /* Poll busy bit during max PHY_TIMEOUT time */
    retries = 0U;
    do
    {
    if ((eth_mac->regs->GMII_ADDRESS & ETH_GMII_ADDRESS_MB_Msk) == 0U)
    {
    *data = (uint16_t)(eth_mac->regs->GMII_DATA & ETH_GMII_DATA_MD_Msk);
    return XMC_ETH_MAC_STATUS_OK;
    }
    ++retries;
    } while (retries < XMC_ETH_MAC_PHY_MAX_RETRIES);
    :

    Alternatively, within the following retry loop, likewise 65535 iterations:

    /* Write physical layer and return status */
    XMC_ETH_MAC_STATUS_t XMC_ETH_MAC_WritePhy(XMC_ETH_MAC_t *eth_mac, uint8_t phy_addr, uint8_t reg_addr, uint16_t data)
    {
    uint32_t retries;
    :
    /* Poll busy bit during max PHY_TIMEOUT time */
    retries = 0U;
    do
    {
    if ((eth_mac->regs->GMII_ADDRESS & ETH_GMII_ADDRESS_MB_Msk) == 0U)
    {
    return XMC_ETH_MAC_STATUS_OK;
    }
    ++retries;
    } while (retries < XMC_ETH_MAC_PHY_MAX_RETRIES);
    :

    Do you know if I can reduce XMC_ETH_MAC_PHY_MAX_RETRIES to something lower than 65535, and still accord with the TCP/IP spec? With Modbus TCP spec?
    XMC_ETH_MAC_PHY_MAX_RETRIES is set within xmc_eth_mac.h:

    :
    * The Ethernet MAC (ETH) is a major communication peripheral that supports 10/100
    * MBit/s data transfer rates in compliance with the IEEE 802.3-2002 standard. The ETH
    * may be used to implement internet connected applications using IPv4 and IPv6. The
    * ETH also includes support for IEEE1588 time synchronisation to allow implementation
    * of Real Time Ethernet protocols.
    :
    /************************************************** ************************************************** ******************
    * MACROS
    ************************************************** ************************************************** *****************/
    :
    #define XMC_ETH_MAC_PHY_MAX_RETRIES (0xffffUL) /**< Maximum retries */
    :

    Best regards,

    David King

  5. #5
    New Member New Member Koumak is on a distinguished road
    Join Date
    Feb 2013
    Posts
    75
    Points
    45.80078125
    Hi David,

    Quick response:
    I had same problem... my first solution was disable autonegotiation
    (i.e.: .enable_auto_negotiate = true
    change to .enable_auto_negotiate = false ... and some related things - set speed and duplex manually)

    But if you need autonegotiation enable - you can change the waiting on autnegotiation complete do while loop to if ... and than you can only check if is complete in your neverending loop

    Hope this helps.

    Best regards,
    Koumak
    Last edited by Koumak; Mar 11th, 2017 at 02:40 AM.

  6. #6
    New Member New Member NAVEEN S is on a distinguished road
    Join Date
    Mar 2017
    Posts
    3
    Points
    37.5
    Hi,

    I am using XMC4700 Modbus tcp with RTOS.

    when i connect XMC directly to a PC .
    1. Ping for the IP is good
    2. Response is better.(I use FNC CODE -15)
    3. It works continuous.

    But when i connect it to a Huge network.
    1.Ping is not good.(Time out occurs often)
    2.As timeout is often request/response is not good.
    3.Device lag in performance.

    Can i get some help on this?

    Is this a issue in networking or our XMC Ethernet module?

    Is this a issue in networking or our XMC ethernet module?

  7. #7
    Beginner Beginner Flax1979 is on a distinguished road
    Join Date
    Jan 2020
    Posts
    1
    Points
    60

    XMC4500 relax kit

    Hi,
    I am Italian, sorry for my English
    How do I receive and send a string of characters by TCP/IP?
    is it possible to use the XMC4500 board for communication with the MODBUS protocol?
    Is there an example of MODBUS TCP / IP for XMC4500?
    the XMC4700 / 4800 MODBUS TCP Client Example is compatible for the XMC4500 board?
    Last edited by Flax1979; Jan 17th, 2020 at 02:55 AM.

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.