Hi David,

I'm glad to help!

More people could want this feature, so it is important to fix.

Best Regards,

Alan

On Tuesday, April 23, 2024, David Welshon <david.wels...@gmail.com> wrote:

> Thank you btw!
>
> On Tue, Apr 23, 2024 at 9:22 PM David Welshon <david.wels...@gmail.com>
> wrote:
>
> > I can help test.  I'll have to get a device tomorrow from work first.
> I'll
> > let you know when I have it setup.
> >
> > On Tue, Apr 23, 2024 at 8:09 PM Alan C. Assis <acas...@gmail.com> wrote:
> >
> >> David,
> >>
> >> I fixed the header, but it seems someone did a partial port of
> FreeModbus,
> >> it is missing many functions for modbus ASCII:
> >>
> >> mb_m.c: In function 'eMBMasterInit':
> >> mb_m.c:176:33: error: 'eMBMasterASCIIStart' undeclared (first use in
> this
> >> function); did you mean 'eMBMasterTCPInit'?
> >>   176 |       pvMBMasterFrameStartCur = eMBMasterASCIIStart;
> >>       |                                 ^~~~~~~~~~~~~~~~~~~
> >>       |                                 eMBMasterTCPInit
> >> mb_m.c:176:33: note: each undeclared identifier is reported only once
> for
> >> each function it appears in
> >> IN: libs/libc/libc.a -> staging/libc.a mb_m.c:177:32: error:
> >> 'eMBMasterASCIIStop' undeclared (first use in this function)
> >>   177 |       pvMBMasterFrameStopCur = eMBMasterASCIIStop;
> >>       |                                ^~~~~~~~~~~~~~~~~~
> >> mb_m.c:178:32: error: 'eMBMasterASCIISend' undeclared (first use in this
> >> function); did you mean 'eMBMasterClose'?
> >>   178 |       peMBMasterFrameSendCur = eMBMasterASCIISend;
> >>       |                                ^~~~~~~~~~~~~~~~~~
> >>       |                                eMBMasterClose
> >> mb_m.c:179:35: error: 'eMBMasterASCIIReceive' undeclared (first use in
> >> this
> >> function); did you mean 'peMBMasterFrameReceiveCur'?
> >>   179 |       peMBMasterFrameReceiveCur = eMBMasterASCIIReceive;
> >>       |                                   ^~~~~~~~~~~~~~~~~~~~~
> >>       |                                   peMBMasterFrameReceiveCur
> >> mb_m.c:181:39: error: 'xMBMasterASCIIReceiveFSM' undeclared (first use
> in
> >> this function)
> >>   181 |       pxMBMasterFrameCBByteReceived = xMBMasterASCIIReceiveFSM;
> >>       |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
> >> mb_m.c:182:43: error: 'xMBMasterASCIITransmitFSM' undeclared (first use
> in
> >> this function); did you mean 'pxMBMasterFrameCBTransmitFSMCur'?
> >>   182 |       pxMBMasterFrameCBTransmitterEmpty =
> >> xMBMasterASCIITransmitFSM;
> >>       |
> >>  ^~~~~~~~~~~~~~~~~~~~~~~~~
> >>       |
> >> pxMBMasterFrameCBTransmitFSMCur
> >> mb_m.c:183:38: error: 'xMBMasterASCIITimerT1SExpired' undeclared (first
> >> use
> >> in this function)
> >>   183 |       pxMBMasterPortCBTimerExpired =
> >> xMBMasterASCIITimerT1SExpired;
> >>       |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> mb_m.c:185:17: warning: implicit declaration of function
> >> 'eMBMasterASCIIInit'; did you mean 'eMBMasterTCPInit'?
> >> [-Wimplicit-function-declaration]
> >>   185 |       eStatus = eMBMasterASCIIInit(ucPort, ulBaudRate, eParity);
> >>       |                 ^~~~~~~~~~~~~~~~~~
> >>       |                 eMBMasterTCPInit
> >> IN: mm/libmm.a -> staging/libmm.a make[2]: ***
> >> [/home/alan/nuttxspace/apps/Application.mk:200:
> >> mb_m.c.home.alan.nuttxspace.apps.modbus.o] Error 1
> >> make[2]: *** Waiting for unfinished jobs....
> >> make[1]: *** [Makefile:51: /home/alan/nuttxspace/apps/modbus_all]
> Error 2
> >> make: *** [tools/LibTargets.mk:232: /home/alan/nuttxspace/apps/
> libapps.a]
> >> Error 2
> >>
> >> I think those functions should be copied from the original project and
> >> added.
> >>
> >> I don't have a device with Modbus ASCII to test, but if you want to help
> >> testing I can implement it.
> >>
> >> Best Regards,
> >>
> >> Alan
> >>
> >> On Tue, Apr 23, 2024 at 8:19 PM David Welshon <david.wels...@gmail.com>
> >> wrote:
> >>
> >> > now it can't find the header file it seems
> >> >
> >> > make[2]: Entering directory '/home/david/nuttxspace/apps/modbus'
> >> >
> >> > CC: mb_m.c
> >> >
> >> > arm-none-eabi-gcc -c -Wstrict-prototypes -Wno-attributes
> >> > -Wno-unknown-pragmas -Wno-psabi -Os -fno-strict-aliasing
> >> > -fomit-frame-pointer -fno-common -Wall -Wshadow -Wundef
> >> -ffunction-sections
> >> > -fdata-sections -mlittle-endian -march=armv7e-m -mtune=cortex-m4
> >> > -mfloat-abi=soft -mthumb -Wa,-mthumb -Wa,-mimplicit-it=always -isystem
> >> > /home/david/nuttxspace/nuttx/include -D__NuttX__ -DNDEBUG -pipe -I
> >> > "/home/david/nuttxspace/apps/include" -I
> >> > /home/david/nuttxspace/apps/modbus/functions -I
> >> > /home/david/nuttxspace/apps/modbus/nuttx mb_m.c -o
> >> > mb_m.c.home.david.nuttxspace.apps.modbus.o
> >> >
> >> > mb_m.c:54:12: fatal error: mbascii.h: No such file or directory
> >> >
> >> > 54 | # include "mbascii.h"
> >> >
> >> > | ^~~~~~~~~~~
> >> >
> >> > compilation terminated.
> >> >
> >> > make[2]: *** [/home/david/nuttxspace/apps/Application.mk:200:
> >> > mb_m.c.home.david.nuttxspace.apps.modbus.o] Error 1
> >> >
> >> > make[2]: Leaving directory '/home/david/nuttxspace/apps/modbus'
> >> >
> >> > make[1]: *** [Makefile:51: /home/david/nuttxspace/apps/modbus_all]
> >> Error 2
> >> >
> >> > make: *** [tools/LibTargets.mk:232:
> >> /home/david/nuttxspace/apps/libapps.a]
> >> > Error 2
> >> >
> >> > make[1]: Leaving directory '/home/david/nuttxspace/apps'
> >> >
> >> > "make all" terminated with exit code 2. Build might be incomplete.
> >> >
> >> > On Tue, Apr 23, 2024 at 6:21 PM Alan C. Assis <acas...@gmail.com>
> >> wrote:
> >> >
> >> > > Whoa, you are totally right!
> >> > >
> >> > > Currently it is this way:
> >> > >
> >> > >   ifeq ($(CONFIG_MODBUS_SLAVE),y)
> >> > >     CSRCS += mb.c
> >> > >   endif
> >> > >
> >> > >   ifeq ($(CONFIG_MB_RTU_MASTER),y)
> >> > >     CSRCS += mb_m.c
> >> > >   endif
> >> > >
> >> > > But I think it should be:
> >> > >
> >> > > ifeq ($(CONFIG_MODBUS),y)
> >> > >
> >> > >   ifeq ($(CONFIG_MODBUS_SLAVE),y)
> >> > >     CSRCS += mb.c
> >> > >   endif
> >> > >
> >> > >   ifeq ($(CONFIG_MODBUS_MASTER),y)
> >> > >     CSRCS += mb_m.c
> >> > >   endif
> >> > >
> >> > > Please test with this modification and let us know.
> >> > >
> >> > > BR,
> >> > >
> >> > > Alan
> >> > >
> >> > > On Tue, Apr 23, 2024 at 6:24 PM David Welshon <
> >> david.wels...@gmail.com>
> >> > > wrote:
> >> > >
> >> > > > HI Alan.
> >> > > >
> >> > > > The problem is my hardware is using the ASCII protocol.  When I
> >> > disabled
> >> > > > ASCII and enabled RTU it compiled.  What I would like is ASCII
> >> > protocol.
> >> > > > It seems like mb_m.c is for modbus master and something like the
> >> > > following
> >> > > > should be in the makefile in the modbus folder but I could be
> >> wrong. I
> >> > > will
> >> > > > try to follow the trail later
> >> > > >
> >> > > > ifeq ($(CONFIG_MB_ASCII_MASTER),y)
> >> > > >
> >> > > > CSRCS += mb_m.c
> >> > > >
> >> > > > endif
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Tue, Apr 23, 2024 at 4:58 PM Alan C. Assis <acas...@gmail.com>
> >> > wrote:
> >> > > >
> >> > > > > Hi David,
> >> > > > >
> >> > > > > Actually ASCII and RTU enable equivalent/symetric functions.
> >> > > > >
> >> > > > > If you search for CONFIG_MB_ASCII_MASTER inside apps/modbus/ you
> >> will
> >> > > see
> >> > > > > it just calls the ASCII related functions.
> >> > > > > The config for RTU will call the binary (RTU) related functions.
> >> > > > >
> >> > > > > Try to disable ASCII master and enable RTU master to confirm.
> >> > > > >
> >> > > > > BR,
> >> > > > >
> >> > > > > Alan
> >> > > > >
> >> > > > > On Tue, Apr 23, 2024 at 4:46 PM David Welshon <
> >> > david.wels...@gmail.com
> >> > > >
> >> > > > > wrote:
> >> > > > >
> >> > > > > > When I changed from Modbus ASCII master selected to MOdbus RTU
> >> > master
> >> > > > it
> >> > > > > > compiled.
> >> > > > > > Is there extra configuration required for ASCII?
> >> > > > > >
> >> > > > > > On Tue, Apr 23, 2024 at 1:38 PM Alan C. Assis <
> >> acas...@gmail.com>
> >> > > > wrote:
> >> > > > > >
> >> > > > > > > I just verified the apps/modbus/Makefile and noticed that
> >> mb.c is
> >> > > > only
> >> > > > > > > compiled when CONFIG_MODBUS_SLAVE is selected.
> >> > > > > > >
> >> > > > > > > It means you are enabling the modbus slave or the modbus
> >> example
> >> > > > (that
> >> > > > > > > assume to be slave).
> >> > > > > > >
> >> > > > > > > So, don't enable CONFIG_EXAMPLES_MODBUS, only
> >> > EXAMPLES_MODBUSMASTER
> >> > > > > > >
> >> > > > > > > Maybe we need to rename CONFIG_EXAMPLES_MODBUS to
> >> > > > > > > CONFIG_EXAMPLES_MODBUSSLAVE.
> >> > > > > > >
> >> > > > > > > Best Regards,
> >> > > > > > >
> >> > > > > > > Alan
> >> > > > > > >
> >> > > > > > > On Tue, Apr 23, 2024 at 2:23 PM David Welshon <
> >> > > > david.wels...@gmail.com
> >> > > > > >
> >> > > > > > > wrote:
> >> > > > > > >
> >> > > > > > > > Thanks for the help and great videos and articles Alan!
> >> > > > > > > > I just went through the video tutorial again.
> Unfortunately,
> >> > > > > modifying
> >> > > > > > my
> >> > > > > > > > own config as well as  the nucleo-f4x1re:f401-nsh
> >> > configurations
> >> > > > per
> >> > > > > > the
> >> > > > > > > > video still can't find the functions
> >> > > > > > > >
> >> > > > > > > > On Tue, Apr 23, 2024 at 12:45 PM Alan C. Assis <
> >> > > acas...@gmail.com>
> >> > > > > > > wrote:
> >> > > > > > > >
> >> > > > > > > > > Hi David,
> >> > > > > > > > >
> >> > > > > > > > > These functions are there (see apps/modbus/mb.c for
> >> > instance).
> >> > > > > > > > >
> >> > > > > > > > > Did you follow this video tutorial:
> >> > > > > > > > > https://www.youtube.com/watch?v=FmJLrG4Ldow
> >> > > > > > > > >
> >> > > > > > > > > Best Regards,
> >> > > > > > > > >
> >> > > > > > > > > Alan
> >> > > > > > > > >
> >> > > > > > > > > On Tue, Apr 23, 2024 at 12:41 PM David Welshon <
> >> > > > > > > david.wels...@gmail.com>
> >> > > > > > > > > wrote:
> >> > > > > > > > >
> >> > > > > > > > > > I am trying to get modbus mastermode rs485 example
> >> working
> >> > on
> >> > > > > > > > > > nucleo-f4x1re following the example on the youtube
> >> channel.
> >> > > I
> >> > > > am
> >> > > > > > > > getting
> >> > > > > > > > > > undefined reference errors during linking and am not
> >> sure
> >> > if
> >> > > I
> >> > > > > need
> >> > > > > > > to
> >> > > > > > > > > > modify source or am missing a configuration option.
> The
> >> > > > device I
> >> > > > > > am
> >> > > > > > > > > > interacting with is set at a baudrate of 9600 with no
> >> > parity
> >> > > > > > instead
> >> > > > > > > of
> >> > > > > > > > > the
> >> > > > > > > > > > baudrate in the video. But other than that I believe I
> >> > > followed
> >> > > > > the
> >> > > > > > > > video
> >> > > > > > > > > > closely.
> >> > > > > > > > > >
> >> > > > > > > > > > I started modifying the nsh config up to this point
> and
> >> > have
> >> > > > > > > zerocross
> >> > > > > > > > > and
> >> > > > > > > > > > gpio working, but I am stuck at the moment on this
> rs485
> >> > bit.
> >> > > > > > > > Appreciate
> >> > > > > > > > > > any help.
> >> > > > > > > > > > Also, I have not participated in many mailing lists,
> so
> >> if
> >> > I
> >> > > am
> >> > > > > in
> >> > > > > > > the
> >> > > > > > > > > > wrong place or I am breakin any etiquette rules I
> >> apologize
> >> > > in
> >> > > > > > > advance
> >> > > > > > > > > and
> >> > > > > > > > > > appreciate your help finding any etiquette rules or
> >> posts
> >> > to
> >> > > > > > > straighten
> >> > > > > > > > > me
> >> > > > > > > > > > out.
> >> > > > > > > > > >
> >> > > > > > > > > > Attached is my build output and config file and below
> >> is a
> >> > > > small
> >> > > > > > > build
> >> > > > > > > > > > output snippet.
> >> > > > > > > > > >
> >> > > > > > > > > > include -D__NuttX__ -DNDEBUG -D__KERNEL__ -I
> >> > > > > > > > > > /home/david/nuttxspace/nuttx/arch/arm/src/chip -I
> >> > > > > > > > > > /home/david/nuttxspace/nuttx/arch/arm/src/common -I
> >> > > > > > > > > > /home/david/nuttxspace/nuttx/arch/arm/src/armv7-m -I
> >> > > > > > > > > > /home/david/nuttxspace/nuttx/sched
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >> /home/david/nuttxspace/nuttx/boards/arm/stm32/nucleo-
> f4x1re/scripts/f401re.ld
> >> > > > > > > > > > -o
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >> /home/david/nuttxspace/nuttx/boards/arm/stm32/nucleo-
> f4x1re/scripts/f401re.ld.tmp
> >> > > > > > > > > >
> >> > > > > > > > > > echo "LD: nuttx"
> >> > > > > > > > > >
> >> > > > > > > > > > LD: nuttx
> >> > > > > > > > > >
> >> > > > > > > > > > arm-none-eabi-ld --entry=__start -nostdlib
> --gc-sections
> >> > > --cref
> >> > > > > > > > > > -Map=/home/david/nuttxspace/nuttx/nuttx.map
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >> -T/home/david/nuttxspace/nuttx/boards/arm/stm32/nucleo-
> f4x1re/scripts/f401re.ld.tmp
> >> > > > > > > > > > -L /home/david/nuttxspace/nuttx/staging -L
> >> > > > > > > > > > /home/david/nuttxspace/nuttx/arch/arm/src/board \
> >> > > > > > > > > >
> >> > > > > > > > > > -o /home/david/nuttxspace/nuttx/nuttx \
> >> > > > > > > > > >
> >> > > > > > > > > > --start-group -lsched -ldrivers -lboards -lc -lmm
> -larch
> >> > -lxx
> >> > > > > > -lapps
> >> > > > > > > > -lfs
> >> > > > > > > > > > -lbinfmt -lboard -lboard
> >> > > > > > > > > >
> >> /usr/lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m/nofp/libgcc.a
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >> /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/
> lib/thumb/v7e-m/nofp/libm.a
> >> > > > > > > > > > --end-group
> >> > > > > > > > > >
> >> > > > > > > > > > arm-none-eabi-ld:
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >> /home/david/nuttxspace/nuttx/staging/libapps.a(modbus_main.
> c.home.david.nuttxspace.apps.examples.modbus_1.o):
> >> > > > > > > > > > in function `modbus_pollthread':
> >> > > > > > > > > >
> >> > > > > > > > > > modbus_main.c:(.text.modbus_pollthread+0x56):
> undefined
> >> > > > reference
> >> > > > > > to
> >> > > > > > > > > > `eMBInit'
> >> > > > > > > > > >
> >> > > > > > > > > > arm-none-eabi-ld:
> >> > > modbus_main.c:(.text.modbus_pollthread+0x82):
> >> > > > > > > > undefined
> >> > > > > > > > > > reference to `eMBSetSlaveID'
> >> > > > > > > > > >
> >> > > > > > > > > > arm-none-eabi-ld:
> >> > > modbus_main.c:(.text.modbus_pollthread+0x98):
> >> > > > > > > > undefined
> >> > > > > > > > > > reference to `eMBClose'
> >> > > > > > > > > >
> >> > > > > > > > > > arm-none-eabi-ld:
> >> > > modbus_main.c:(.text.modbus_pollthread+0x9e):
> >> > > > > > > > undefined
> >> > > > > > > > > > reference to `eMBEnable'
> >> > > > > > > > > >
> >> > > > > > > > > > arm-none-eabi-ld:
> >> > > modbus_main.c:(.text.modbus_pollthread+0xbe):
> >> > > > > > > > undefined
> >> > > > > > > > > > reference to `eMBPoll'
> >> > > > > > > > > >
> >> > > > > > > > > > arm-none-eabi-ld:
> >> > > modbus_main.c:(.text.modbus_pollthread+0xc4):
> >> > > > > > > > undefined
> >> > > > > > > > > > reference to `eMBDisable'
> >> > > > > > > > > >
> >> > > > > > > > > > arm-none-eabi-ld:
> >> > > modbus_main.c:(.text.modbus_pollthread+0xc8):
> >> > > > > > > > undefined
> >> > > > > > > > > > reference to `eMBClose'
> >> > > > > > > > > >
> >> > > > > > > > > > make[1]: *** [Makefile:211: nuttx] Error 1
> >> > > > > > > > > >
> >> > > > > > > > > > make[1]: Leaving directory
> >> > > > > > > '/home/david/nuttxspace/nuttx/arch/arm/src'
> >> > > > > > > > > >
> >> > > > > > > > > > make: *** [tools/Unix.mk:546: nuttx] Error 2
> >> > > > > > > > > >
> >> > > > > > > > > > "make all" terminated with exit code 2. Build might be
> >> > > > > incomplete.
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >
>

Reply via email to