Author Topic: Modbus over rs485 for keaz128 many undefined reference  (Read 5645 times)

Offline Kiger

  • Newbie
  • *
  • Posts: 5
    • View Profile
Modbus over rs485 for keaz128 many undefined reference
« on: June 01, 2017, 04:26:24 AM »
Dear Mark   @Mark

If  active the   define  MODBUS_RS485_SUPPORT , there are many undefined references.

Do I need implement  all the function by myself?

Hardware: FRDM_KEAZ128Q80
IDE: codewarrior 10.7

linker output:

Description   Resource   Path   Location   Type
mingw32-make: *** [uTaskerV1_4.elf] Error 1   uTasker-Kinetis-master          C/C++ Problem
implicit declaration of function '_CONFIGURE_RTS_0_HIGH' [-Wimplicit-function-declaration]   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1403   C/C++ Problem
implicit declaration of function 'fnConfigRTS_delay' [-Wimplicit-function-declaration]   MODBUS.c   /uTasker-Kinetis-master/uTasker/MODBUS   line 910   C/C++ Problem
undefined reference to `_SET_RTS_0_HIGH'   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1638   C/C++ Problem
undefined reference to `fnConfigRTS_delay'   MODBUS.c   /uTasker-Kinetis-master/uTasker/MODBUS   line 910   C/C++ Problem
undefined reference to `_SET_RTS_1_HIGH'   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1642   C/C++ Problem
undefined reference to `_SET_RTS_1_LOW'   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1610   C/C++ Problem
'ucNexttestPort' defined but not used [-Wunused-variable]   modbus_app.c   /uTasker-Kinetis-master/Applications/uTaskerV1.4   line 469   C/C++ Problem
undefined reference to `_SET_RTS_2_HIGH'   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1647   C/C++ Problem
undefined reference to `_SET_RTS_2_LOW'   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1615   C/C++ Problem
undefined reference to `_SET_RTS_0_LOW'   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1606   C/C++ Problem
undefined reference to `_CONFIGURE_RTS_2_HIGH'   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1451   C/C++ Problem
undefined reference to `_CONFIGURE_RTS_2_LOW'   kinetis_UART.h   /uTasker-Kinetis-master/Hardware/Kinetis   line 1455   C/C++ Problem
« Last Edit: June 01, 2017, 07:54:03 AM by Kiger »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Modbus over rs485 for keaz128 many undefined reference
« Reply #1 on: June 01, 2017, 06:08:46 PM »
Hi

The KEA128 doesn't have an RTS line, which is used to control the RS485 direction, and it is therefore necessary to use a general purpose IO instead. Since there is no pre-defined output for such operation you need to add macros to suit the board in question.

You can use the FRDM_KL02Z configuration as reference, where the following set of macros is included in app_hw_kinetis.h:

    // RTS control via GPIO output
    //
    #define RTS_0_LINE              PORTB_BIT0
    #define _CONFIGURE_RTS_0_HIGH() _CONFIG_DRIVE_PORT_OUTPUT_VALUE(B, (RTS_0_LINE), (RTS_0_LINE), (PORT_SRE_SLOW | PORT_DSE_HIGH))
    #define _CONFIGURE_RTS_0_LOW()  _CONFIG_DRIVE_PORT_OUTPUT_VALUE(B, (RTS_0_LINE), (0), (PORT_SRE_SLOW | PORT_DSE_HIGH))
    #define _SET_RTS_0_HIGH()       _SETBITS(B, RTS_0_LINE)
    #define _SET_RTS_0_LOW()        _CLEARBITS(B, RTS_0_LINE)


This can be performed for each available UART to allow each to control its own RTS output.
In case there is no need for an output on a particular UART, dummy macros can be added - for example
    #define _CONFIGURE_RTS_1_HIGH()
    #define _CONFIGURE_RTS_1_LOW()
    #define _SET_RTS_1_HIGH()
    #define _SET_RTS_1_LOW()


Regards

Mark