Re: Serialrx

2023-08-29 Thread Xiang Xiao
On Wed, Aug 30, 2023 at 5:49 AM Bert Voldenuit 
wrote:

> Hi,
> Alan,
> I use ./tool/configure.sh arduino-m0/nsh
> Thanks to your blog, I am porting an arduino project to Nuttx
>
> Xiang Xiao,
> Indeed  DEFAULT_SMALL was activated. it works with CONFIG_FILE_STREAM
> enabled. How did you know?
>
>
This is a recent improvement to reduce the code size in the minimal
configuration:
https://github.com/apache/nuttx-apps/pull/1559
https://github.com/apache/nuttx/pull/4819


> Thank you for your support.
> Bert.
>
> Le mar. 29 août 2023 à 04:20, Xiang Xiao  a
> écrit :
>
> > Do you enable DEFAULT_SMALL? If so, you have to enable CONFIG_FILE_STREAM
> > in defconfig explicitly.
> >
> > On Tue, Aug 29, 2023 at 6:11 AM Bert Voldenuit 
> > wrote:
> >
> > > Hello,
> > >
> > > I am trying to run the serialrx app (out of the box) from the examples,
> > but
> > > i get the following errors:
> > >
> > > - Some warnings because of conversion; no big deal
> > > - undefined reference to standard librarie function like: fprintf,
> > > lib_get_stream, fflush; I think this is the main problem but why?
> > >
> > > bert@DESKTOP-UO6EU0I:/mnt/d/BertDocs/nuttxspace12/nuttx$ make
> > > Create version.h
> > > LN: platform/board to /mnt/d/BertDocs/nuttxspace12/apps/platform/dummy
> > > Register: custom_hello
> > > Register: serialrx
> > > Register: nsh
> > > Register: sh
> > > CC:  serialrx_main.c serialrx_main.c: In function 'serialrx_main':
> > > serialrx_main.c:83:15: warning: passing argument 1 of 'fprintf' makes
> > > pointer from integer without a cast [-Wint-conversion]
> > >83 |   fprintf(stderr, "Usage: %s [devpath]\n", argv[0]);
> > >   |   ^~
> > >   |   |
> > >   |   int
> > > In file included from serialrx_main.c:31:
> > > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:147:26: note:
> expected
> > > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> > >   147 | intfprintf(FAR FILE *stream, FAR const IPTR char *format,
> > ...)
> > >   |~~^~
> > > serialrx_main.c:95:15: warning: passing argument 1 of 'fprintf' makes
> > > pointer from integer without a cast [-Wint-conversion]
> > >95 |   fprintf(stderr, "ERROR: malloc failed: %d\n", errno);
> > >   |   ^~
> > >   |   |
> > >   |   int
> > > In file included from serialrx_main.c:31:
> > > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:147:26: note:
> expected
> > > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> > >   147 | intfprintf(FAR FILE *stream, FAR const IPTR char *format,
> > ...)
> > >   |~~^~
> > > serialrx_main.c:110:15: warning: passing argument 1 of 'fprintf' makes
> > > pointer from integer without a cast [-Wint-conversion]
> > >   110 |   fprintf(stderr, "ERROR: open failed: %d\n", errno);
> > >   |   ^~
> > >   |   |
> > >   |   int
> > > In file included from serialrx_main.c:31:
> > > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:147:26: note:
> expected
> > > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> > >   147 | intfprintf(FAR FILE *stream, FAR const IPTR char *format,
> > ...)
> > >   |~~^~
> > > serialrx_main.c:116:10: warning: passing argument 1 of 'fflush' makes
> > > pointer from integer without a cast [-Wint-conversion]
> > >   116 |   fflush(stdout);
> > >   |  ^~
> > >   |  |
> > >   |  int
> > > In file included from serialrx_main.c:31:
> > > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:139:25: note:
> expected
> > > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> > >   139 | intfflush(FAR FILE *stream);
> > >   |   ~~^~
> > > serialrx_main.c:143:18: warning: passing argument 1 of 'fflush' makes
> > > pointer from integer without a cast [-Wint-conversion]
> > >   143 |   fflush(stdout);
> > >   |  ^~
> > >   |  |
> > >   |  int
> > > In file included from serialrx_main.c:31:
> > > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:139:25: note:
> expected
> > > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> > >   139 | intfflush(FAR FILE *stream);
> > >   |   ~~^~
> > > serialrx_main.c:153:22: warning: passing argument 1 of 'fflush' makes
> > > pointer from integer without a cast [-Wint-conversion]
> > >   153 |   fflush(stdout);
> > >   |  ^~
> > >   |  |
> > >   |  int
> > > In file included from serialrx_main.c:31:
> > > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:139:25: note:
> expected
> > > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> > >   

Re: Serialrx

2023-08-29 Thread Bert Voldenuit
Hi,
Alan,
I use ./tool/configure.sh arduino-m0/nsh
Thanks to your blog, I am porting an arduino project to Nuttx

Xiang Xiao,
Indeed  DEFAULT_SMALL was activated. it works with CONFIG_FILE_STREAM
enabled. How did you know?

Thank you for your support.
Bert.

Le mar. 29 août 2023 à 04:20, Xiang Xiao  a
écrit :

> Do you enable DEFAULT_SMALL? If so, you have to enable CONFIG_FILE_STREAM
> in defconfig explicitly.
>
> On Tue, Aug 29, 2023 at 6:11 AM Bert Voldenuit 
> wrote:
>
> > Hello,
> >
> > I am trying to run the serialrx app (out of the box) from the examples,
> but
> > i get the following errors:
> >
> > - Some warnings because of conversion; no big deal
> > - undefined reference to standard librarie function like: fprintf,
> > lib_get_stream, fflush; I think this is the main problem but why?
> >
> > bert@DESKTOP-UO6EU0I:/mnt/d/BertDocs/nuttxspace12/nuttx$ make
> > Create version.h
> > LN: platform/board to /mnt/d/BertDocs/nuttxspace12/apps/platform/dummy
> > Register: custom_hello
> > Register: serialrx
> > Register: nsh
> > Register: sh
> > CC:  serialrx_main.c serialrx_main.c: In function 'serialrx_main':
> > serialrx_main.c:83:15: warning: passing argument 1 of 'fprintf' makes
> > pointer from integer without a cast [-Wint-conversion]
> >83 |   fprintf(stderr, "Usage: %s [devpath]\n", argv[0]);
> >   |   ^~
> >   |   |
> >   |   int
> > In file included from serialrx_main.c:31:
> > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:147:26: note: expected
> > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> >   147 | intfprintf(FAR FILE *stream, FAR const IPTR char *format,
> ...)
> >   |~~^~
> > serialrx_main.c:95:15: warning: passing argument 1 of 'fprintf' makes
> > pointer from integer without a cast [-Wint-conversion]
> >95 |   fprintf(stderr, "ERROR: malloc failed: %d\n", errno);
> >   |   ^~
> >   |   |
> >   |   int
> > In file included from serialrx_main.c:31:
> > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:147:26: note: expected
> > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> >   147 | intfprintf(FAR FILE *stream, FAR const IPTR char *format,
> ...)
> >   |~~^~
> > serialrx_main.c:110:15: warning: passing argument 1 of 'fprintf' makes
> > pointer from integer without a cast [-Wint-conversion]
> >   110 |   fprintf(stderr, "ERROR: open failed: %d\n", errno);
> >   |   ^~
> >   |   |
> >   |   int
> > In file included from serialrx_main.c:31:
> > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:147:26: note: expected
> > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> >   147 | intfprintf(FAR FILE *stream, FAR const IPTR char *format,
> ...)
> >   |~~^~
> > serialrx_main.c:116:10: warning: passing argument 1 of 'fflush' makes
> > pointer from integer without a cast [-Wint-conversion]
> >   116 |   fflush(stdout);
> >   |  ^~
> >   |  |
> >   |  int
> > In file included from serialrx_main.c:31:
> > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:139:25: note: expected
> > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> >   139 | intfflush(FAR FILE *stream);
> >   |   ~~^~
> > serialrx_main.c:143:18: warning: passing argument 1 of 'fflush' makes
> > pointer from integer without a cast [-Wint-conversion]
> >   143 |   fflush(stdout);
> >   |  ^~
> >   |  |
> >   |  int
> > In file included from serialrx_main.c:31:
> > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:139:25: note: expected
> > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> >   139 | intfflush(FAR FILE *stream);
> >   |   ~~^~
> > serialrx_main.c:153:22: warning: passing argument 1 of 'fflush' makes
> > pointer from integer without a cast [-Wint-conversion]
> >   153 |   fflush(stdout);
> >   |  ^~
> >   |  |
> >   |  int
> > In file included from serialrx_main.c:31:
> > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:139:25: note: expected
> > 'FILE *' {aka 'struct file_struct *'} but argument is of type 'int'
> >   139 | intfflush(FAR FILE *stream);
> >   |   ~~^~
> > serialrx_main.c:182:10: warning: passing argument 1 of 'fflush' makes
> > pointer from integer without a cast [-Wint-conversion]
> >   182 |   fflush(stdout);
> >   |  ^~
> >   |  |
> >   |  int
> > In file included from serialrx_main.c:31:
> > /mnt/d/BertDocs/nuttxspace12/nuttx/include/stdio.h:139:25: note: expected
> > 'FILE 

Re: Adding bluetooth configuration on esp32 hangs nsh

2023-08-29 Thread Tiago Medicci Serrano
Hi,

I'll take a look at it soon. Interestingly, our internal CI tests all the
defconfigs, so I wouldn't expect any erroneous behavior.

I'll check.

Best regards,

Em ter., 29 de ago. de 2023 às 16:38, Mike Moretti
 escreveu:

> Hi,
>
> I'm using NuttX 12.2.1 on an esp32 wroom devkit.
>
> If I try to configure NuttX via tools/configure.sh using the
> esp32-devkitc:blewifi configuration, when I boot the esp32, I get problems
> with it telling me there's no bootable app.
>
> If I instead start with the esp32-devkitc:nsh configuration and add wifi
> and ble to it via menuconfig, I get only a little further.  It gets past
> the entropy message and then I see "AB" and it hangs forever.  With all the
> ble options disabled and only wifi configured by itself it actually boots
> into nsh after some time.  (At first, I had a somewhat similar issue with
> nsh when wifi only is enabled and connection info wasn't defined in the
> config file, where it would seem to hang and then finally show a prompt.
> It wasn't until I actually figured out about turning on CONFIG_DEBUG
> "ERROR" for network/wireless that it showed me a bunch of errors during
> boot and I knew it wasn't just hanging permanently and to just wait for it
> a bit to show an nsh prompt.)
>
> However, there don't seem to be any config debug options for bluetooth.  I
> have no idea why it hangs as no messages are displayed and it never shows a
> prompt even after a half an hour.  I've now spent hours messing with
> various BLE configuration options with no luck.  I'm including my config
> file in hope that someone might see something wrong with it.
>
> Thanks,
> -m
> --
> Mike Moretti
> ♩♫♫♩♪♩
>


-- 
Tiago Medicci Serrano

Embedded Software Engineer
MSc Electronics/Microelectronics
m: +55 (19) 981403886 <+55+(19)+981403886>
e: tiago.medi...@gmail.com
a: Campinas, Brazil
Follow me:




Adding bluetooth configuration on esp32 hangs nsh

2023-08-29 Thread Mike Moretti

Hi,

I'm using NuttX 12.2.1 on an esp32 wroom devkit.

If I try to configure NuttX via tools/configure.sh using the 
esp32-devkitc:blewifi configuration, when I boot the esp32, I get 
problems with it telling me there's no bootable app.


If I instead start with the esp32-devkitc:nsh configuration and add wifi 
and ble to it via menuconfig, I get only a little further.  It gets past 
the entropy message and then I see "AB" and it hangs forever.  With all 
the ble options disabled and only wifi configured by itself it actually 
boots into nsh after some time.  (At first, I had a somewhat similar 
issue with nsh when wifi only is enabled and connection info wasn't 
defined in the config file, where it would seem to hang and then finally 
show a prompt.  It wasn't until I actually figured out about turning on 
CONFIG_DEBUG "ERROR" for network/wireless that it showed me a bunch of 
errors during boot and I knew it wasn't just hanging permanently and to 
just wait for it a bit to show an nsh prompt.)


However, there don't seem to be any config debug options for bluetooth.  
I have no idea why it hangs as no messages are displayed and it never 
shows a prompt even after a half an hour.  I've now spent hours messing 
with various BLE configuration options with no luck.  I'm including my 
config file in hope that someone might see something wrong with it.


Thanks,
-m
--
Mike Moretti
♩♫♫♩♪♩
#
# License Setup
#
CONFIG_ALLOW_BSD_COMPONENTS=y
# CONFIG_ALLOW_GPL_COMPONENTS is not set
# CONFIG_ALLOW_MIT_COMPONENTS is not set
# end of License Setup

#
# Build Setup
#
# CONFIG_EXPERIMENTAL is not set
# CONFIG_DEFAULT_SMALL is not set
CONFIG_HOST_LINUX=y
# CONFIG_HOST_MACOS is not set
# CONFIG_HOST_WINDOWS is not set
# CONFIG_HOST_OTHER is not set

#
# Build Configuration
#
CONFIG_APPS_DIR="../apps"
CONFIG_BASE_DEFCONFIG="esp32-devkitc:nsh-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty-dirty"
CONFIG_BUILD_FLAT=y
# CONFIG_BUILD_2PASS is not set
# end of Build Configuration

#
# Binary Output Formats
#
CONFIG_INTELHEX_BINARY=y
# CONFIG_MOTOROLA_SREC is not set
# CONFIG_RAW_BINARY is not set
# CONFIG_UBOOT_UIMAGE is not set
# CONFIG_DFU_BINARY is not set
# end of Binary Output Formats

#
# Customize Header Files
#
# CONFIG_ARCH_FLOAT_H is not set
CONFIG_ARCH_HAVE_STDARG_H=y
# CONFIG_ARCH_STDARG_H is not set
CONFIG_ARCH_HAVE_SETJMP=y
# CONFIG_ARCH_SETJMP_H is not set
CONFIG_ARCH_NONE_DEBUG_H=y
# CONFIG_ARCH_DEBUG_H is not set
# CONFIG_ARCH_CHIP_DEBUG_H is not set
# end of Customize Header Files

#
# Debug Options
#
CONFIG_NDEBUG=y
CONFIG_DEBUG_ALERT=y
CONFIG_DEBUG_FEATURES=y

#
# Debug SYSLOG Output Controls
#
CONFIG_DEBUG_ERROR=y
CONFIG_DEBUG_WARN=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y

#
# Subsystem Debug Options
#
# CONFIG_DEBUG_BINFMT is not set
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_FS_ERROR=y
CONFIG_DEBUG_FS_WARN=y
# CONFIG_DEBUG_FS_INFO is not set
# CONFIG_DEBUG_GRAPHICS is not set
CONFIG_DEBUG_LIB=y
CONFIG_DEBUG_LIB_ERROR=y
CONFIG_DEBUG_LIB_WARN=y
# CONFIG_DEBUG_LIB_INFO is not set
# CONFIG_DEBUG_SYS_QUEUE is not set
# CONFIG_DEBUG_MM is not set
CONFIG_DEBUG_NET=y
CONFIG_DEBUG_NET_ERROR=y
# CONFIG_DEBUG_NET_WARN is not set
# CONFIG_DEBUG_NET_INFO is not set
# CONFIG_DEBUG_POWER is not set
# CONFIG_DEBUG_BATTERY is not set
CONFIG_DEBUG_WIRELESS=y
CONFIG_DEBUG_WIRELESS_ERROR=y
# CONFIG_DEBUG_WIRELESS_WARN is not set
# CONFIG_DEBUG_WIRELESS_INFO is not set
CONFIG_DEBUG_SCHED=y
CONFIG_DEBUG_SCHED_ERROR=y
CONFIG_DEBUG_SCHED_WARN=y
# CONFIG_DEBUG_SCHED_INFO is not set

#
# OS Function Debug Options
#
# CONFIG_DEBUG_DMA is not set
# CONFIG_DEBUG_IRQ is not set

#
# Driver Debug Options
#
# CONFIG_DEBUG_LEDS is not set
CONFIG_DEBUG_GPIO=y
CONFIG_DEBUG_GPIO_ERROR=y
CONFIG_DEBUG_GPIO_WARN=y
CONFIG_DEBUG_GPIO_INFO=y
CONFIG_DEBUG_SPI=y
CONFIG_DEBUG_SPI_ERROR=y
CONFIG_DEBUG_SPI_WARN=y
# CONFIG_DEBUG_SPI_INFO is not set
CONFIG_DEBUG_TIMER=y
CONFIG_DEBUG_TIMER_ERROR=y
CONFIG_DEBUG_TIMER_WARN=y
CONFIG_DEBUG_TIMER_INFO=y
# CONFIG_DEBUG_TCBINFO is not set
CONFIG_ARCH_HAVE_STACKCHECK=y
CONFIG_STACK_COLORATION=y
# CONFIG_STACK_CANARIES is not set
# CONFIG_STACK_USAGE is not set
CONFIG_DEBUG_SYMBOLS=y
# CONFIG_FRAME_POINTER is not set
# end of Debug Options

CONFIG_ARCH_HAVE_CUSTOMOPT=y
# CONFIG_DEBUG_NOOPT is not set
# CONFIG_DEBUG_CUSTOMOPT is not set
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y

GPIO and interrupts

2023-08-29 Thread Mark Stevens
I am trying to figure out GPIO and interrupts.  So the situation is I have four 
switches connected to GPIOs on my board.  My ideal scenario is to attach a 
different interrupt to each switch and have that fired when the appropriate 
button is pressed.

So I have spent some time looking at the gpis_main.c file and I have changed 
the code that sets the event to:

notify.sigev_notify = SIGEV_THREAD;
notify.sigev_notify_function = sigev_notify_function;


And I am getting the interrupt for one button as expected.  Too many interrupts 
in fact - I have debounced the input in hardware using a 555 so the signal 
should be good.

I am struggling to work out how to do this for the remaining buttons without 
spinning up multiple threads all effectively running the same code but with 
different devices.

I came across the buttons example but this appears to be disabled for this 
board.

Any advice would be gratefully received.

Regards,
Mark
_
Blog: blog.thepcsite.co.uk
Twitter: @nevynuk







bt4 + ble5 (plus wifi) on esp32

2023-08-29 Thread nuttx

Hi,

I'm developing a device using an ESP32 with NuttX that needs to 
broadcast a beacon/advertise on both bt4 and ble5 (and also do radio 
sharing with wifi).  I've done some work with ble 5 with ESP-IDF and 
understand a little about bluetooth.  Unfortunately, I can't seem to 
find any documentation or examples of bluetooth for NuttX except for the 
very limited btsak shell command code that looks like it only supports 
ble 5.  I was hoping I wouldn't have to try to reverse engineer the 
various bluetooth layers in the guts of NuttX to figure this out.  Does 
anyone have any examples or info on how to configure/implement something 
like this?  It's required to support both bt4 and ble5 at the same time, 
unfortunately (but luckily it's only a beacon).


Thanks,
-m
--
Mike Moretti
♩♫♫♩♪♩