Re: nuttx user question

2024-04-30 Thread Alan C. Assis
Hi David,

I think we can start creating the missing functions, like
eMBMasterASCIIStart(), I think we could use eMBMasterRTUStart() as
reference.

Probably we will need to modify some timing values, since ASCII delays more
time to transmit data.

Best Regards,

Alan


On Tue, Apr 30, 2024 at 12:36 PM David Welshon 
wrote:

> Ok,
> I have the device setup. I can help test whenever needed.
> David
>
> On Wed, Apr 24, 2024 at 7:17 AM Alan C. Assis  wrote:
>
> > 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 
> wrote:
> >
> > > Thank you btw!
> > >
> > > On Tue, Apr 23, 2024 at 9:22 PM David Welshon  >
> > > 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 
> > 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 

Re: Multiple zerocross pins

2024-04-30 Thread Alan C. Assis
Hi David,

The pin is defined as BOARD_ZEROCROSS_GPIO, please look at

nuttx/boards/arm/stm32/stm32f103-minimum/include/board.h
nuttx/boards/arm/stm32/stm32f4discovery/include/board.h

The board initialization code is here:
nuttx/boards/arm/stm32/common/src/stm32_zerocross.c

And the example is here: apps/examples/zerocross/zerocross_main.c

The old video example is here: https://www.youtube.com/watch?v=NRMnW6jKsiw

Best Regards,

Alan

On Tue, Apr 30, 2024 at 4:07 PM David Welshon 
wrote:

> Is there an example driver, that I should/could look at to add pins to the
> zerocrossdriver?
> What would be the steps involved if I wanted to add pins to an stm32f401re?
> I am currently using the stm32_zerocross in the stm32/common/src folder.
>
> but it looks like this lower half is hardcoded for 1 pin.
>
> Thanks for any pointers
>
> David
>


Multiple zerocross pins

2024-04-30 Thread David Welshon
Is there an example driver, that I should/could look at to add pins to the
zerocrossdriver?
What would be the steps involved if I wanted to add pins to an stm32f401re?
I am currently using the stm32_zerocross in the stm32/common/src folder.

but it looks like this lower half is hardcoded for 1 pin.

Thanks for any pointers

David


Re: nuttx user question

2024-04-30 Thread David Welshon
Ok,
I have the device setup. I can help test whenever needed.
David

On Wed, Apr 24, 2024 at 7:17 AM Alan C. Assis  wrote:

> 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  wrote:
>
> > Thank you btw!
> >
> > On Tue, Apr 23, 2024 at 9:22 PM David Welshon 
> > 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 
> 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
> > >> >