Hello Matt,

You have 2 enable i2ctool in make menuconfig (also see blog Alan):
https://acassis.wordpress.com/2019/01/19/how-to-use-nuttx-i2c-scan-features/

And then on the prompt in NuttX you can do the command say:
i2c dev -b 1 0x00 0x7f

It will show you the used I2C addresses.

Hope this will help you!

With kind regards,
Ben
nuttx.nl


-----Oorspronkelijk bericht-----
Van: Matt DeWall <mdew...@gmail.com> 
Verzonden: dinsdag 8 december 2020 21:17
Aan: dev@nuttx.apache.org
Onderwerp: Re: ssd1306 oled help

Thanks everyone - apologies for the delay, some other priorities blocked me.

Looks like I was getting bit by cygwin and "make clean_context all" got me 
sorted out and actually reflected my changes.

However, I'd like to understand how to get the i2ctool working.  I was able to 
add it and see it in nsh, though it reports that no buses are found.

I added this to my stm32_bringup.c (ripped it from the stm32f4discovery):


---------------------
#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL) static void 
stm32_i2c_register(int bus) {
  FAR struct i2c_master_s *i2c;
  int ret;

  i2c = stm32_i2cbus_initialize(bus);
  if (i2c == NULL)
    {
      syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus);
    }
  else
    {
      ret = i2c_register(i2c, bus);
      if (ret < 0)
        {
          syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n",
                 bus, ret);
          stm32_i2cbus_uninitialize(i2c);
        }
    }
}
#endif

/****************************************************************************
 * Name: stm32_i2ctool
 *
 * Description:
 *   Register I2C drivers for the I2C tool.
 *
 ****************************************************************************/

#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL) static void 
stm32_i2ctool(void) {
  stm32_i2c_register(1);
#if 0
  stm32_i2c_register(1);
  stm32_i2c_register(2);
#endif
}
#else
#  define stm32_i2ctool()
#endif

----------------------

Yet when I run the i2ctool from nsh I get this:

nsh> i2c bus
 BUS   EXISTS?
Bus 0: NO
Bus 1: NO
Bus 2: NO
Bus 3: NO
Bus 4: NO
Bus 5: NO

I'd like to understand how to get this tool running as I'll probably be needing 
it in the future.  :)

Thanks everyone!

Matt

On Sun, Dec 6, 2020 at 5:56 AM Alan Carvalho de Assis <acas...@gmail.com>
wrote:

> Hi Matt,
>
> Sorry my delay to reply.
>
> As Mr. Greg pointed the issue is related to your OLED display I2C address.
>
> Normally these OLED display has an Address Select using a 0R resistor 
> to 0x78 or 0x7A.
>
> You need to setup the CONFIG_SSD1306_I2CADDR with the right address.
>
> Also as Mr. Ben suggested, using the i2ctool you can scan your I2C bus 
> and find the I2C address that your display is using.
>
> Any issue, please let us to know.
>
> BR,
>
> Alan
>
> On 12/4/20, Matt DeWall <mdew...@gmail.com> wrote:
> > Didn't know about that one, thanks!  Found one of Alan's articles 
> > for
> that
> > and gonna give that a shot.
> >
> > Matt
> >
> > On Fri, Dec 4, 2020 at 5:01 PM Disruptive Solutions < 
> > disruptivesolution...@gmail.com> wrote:
> >
> >> Did you try the i2c tool?
> >>
> >> Op za 5 dec. 2020 1:58 a.m. schreef Matt DeWall <mdew...@gmail.com>:
> >>
> >> > Got it.  Ok - looks like my 116 errors were from my later 
> >> > experimenting.
> >> > If I completely disconnect or try other i2c pins, I get 116, so 
> >> > that
> >> makes
> >> > sense.
> >> >
> >> > So it looks like when I connect the pins correctly I'm getting 
> >> > the 6
> >> error.
> >> >
> >> > I'm wondering if that just means somehow my device has an i2c 
> >> > address
> >> that
> >> > isn't the default that the driver is looking for?
> >> >
> >> > Mat
> >> >
> >> > On Fri, Dec 4, 2020 at 4:25 PM Gregory Nutt <spudan...@gmail.com>
> >> > wrote:
> >> >
> >> > > Should have mentioned that the error code 6 is defined in
> >> > include/errno.h:
> >> > >
> >> > >     #define ENXIO               6
> >> > >     #define ENXIO_STR           "No such device or address"
> >> > >
> >> > > And errcode code 116 is:
> >> > >
> >> > >     #define ETIMEDOUT           116
> >> > >     #define ETIMEDOUT_STR       "Connection timed out"
> >> > >
> >> > > Which is also reported by as an I2C failure by stm32_i2c_transfer():
> >> > >
> >> > >        if (stm32_i2c_sem_waitdone(priv) < 0)
> >> > >          {
> >> > >            status = stm32_i2c_getstatus(priv);
> >> > >            ret = -ETIMEDOUT;
> >> > >
> >> > > On 12/4/2020 6:19 PM, Gregory Nutt wrote:
> >> > > >
> >> > > > As far as I can tell, this looks like an I2C problem.  Alan
> problem
> >> > > > knows better than I.
> >> > > >
> >> > > > I think the failure sequence is:
> >> > > >
> >> > > >     fs/vfs:
> >> > > >         ioctl(FBIO_UPDATE)
> >> > > >
> >> > > >     drivers/video/fb.c ioctl method:
> >> > > >         ret = fb->vtable->updatearea(fb->vtable, area);
> >> > > >
> >> > > >     drivers/lcd/lcd_framebuffer.c, function lcdfb_updateearea():
> >> > > >         ret = pinfo->putrun(row, startx, run, width);
> >> > > >
> >> > > >     drivers/lcd/ssd1306.c, putrun method:
> >> > > >         Calls ssd1306_sendbyte()
> >> > > >
> >> > > >     arch/arm/src/stm32/stm32_i2c.c,
> >> > > >         else if (status & I2C_SR1_AF)
> >> > > >           {
> >> > > >             /* Acknowledge Failure */
> >> > > >
> >> > > >             ret = -ENXIO;
> >> > > >           }
> >> > > >
> >> > > > So my best guess is that there is some issue with your I2C 
> >> > > > interface.
> >> > > > It might be failing to acknowledge.
> >> > > >
> >> > > > On 12/4/2020 4:56 PM, Matt DeWall wrote:
> >> > > >> Hello NuttX devs!
> >> > > >>
> >> > > >> I've followed Alan's great tutorial on setting up an OLED on 
> >> > > >> the
> >> Blue
> >> > > Pill
> >> > > >> stm32f103-minimum board but running into trouble.
> >> > > >>
> >> > > >> Video:
> >> > > >> https://www.youtube.com/watch?v=TZ4i71ArtRo&t=245s
> >> > > >>
> >> > > >> * I've compiled, flashed, and able to get into nsh
> >> > > >> * The fb driver is listed as /dev/fb0 and the 'fb' app is 
> >> > > >> present
> >> > > >> * When I run the 'fb' app I get repetitive errors, two 
> >> > > >> different
> >> > codes,
> >> > > but
> >> > > >> usually '6' (sometimes '116')
> >> > > >>
> >> > > >> --------------------------
> >> > > >> nsh> fb
> >> > > >> VideoInfo:
> >> > > >>        fmt: 0
> >> > > >>       xres: 128
> >> > > >>       yres: 64
> >> > > >>    nplanes: 1
> >> > > >> PlaneInfo (plane 0):
> >> > > >>      fbmem: 0x20002f40
> >> > > >>      fblen: 1024
> >> > > >>     stride: 16
> >> > > >>    display: 0
> >> > > >>        bpp: 1
> >> > > >> Mapped FB: 0x20002f40
> >> > > >>   0: (  0,  0) (128, 64)
> >> > > >> ERROR: ioctl(FBIO_UPDATE) failed: 6
> >> > > >>   1: ( 11,  5) (106, 54)
> >> > > >> ERROR: ioctl(FBIO_UPDATE) failed: 6
> >> > > >>   2: ( 22, 10) ( 84, 44)
> >> > > >> ERROR: ioctl(FBIO_UPDATE) failed: 6
> >> > > >>   3: ( 33, 15) ( 62, 34)
> >> > > >> ERROR: ioctl(FBIO_UPDATE) failed: 6
> >> > > >>   4: ( 44, 20) ( 40, 24)
> >> > > >> ERROR: ioctl(FBIO_UPDATE) failed: 6
> >> > > >>   5: ( 55, 25) ( 18, 14)
> >> > > >> ERROR: ioctl(FBIO_UPDATE) failed: 6 Test finished
> >> > > >>
> >> > > >>
> >> > > >> * I have verified that the screen is working and wired up
> >> > > >> correctly
> >> > > using
> >> > > >> an Arduino Mega.
> >> > > >> * I'm using this ssd1306 HiLet Go 128X64 OLED:
> >> > > >>
> >> > >
> >> >
> >>
> https://www.amazon.com/gp/product/B06XRBTBTB/ref=ppx_yo_dt_b_asin_title_o02_s01?ie=UTF8&psc=1
> >> > > >> * AFAIK I've done an apples/apples with the tutorial, same board,
> >> same
> >> > > >> screen, same wiring, but no luck.
> >> > > >>
> >> > > >> I'm at a loss, as debugging at this low of a level is pretty
> >> > > >> foreign
> >> > to
> >> > > >> me.  It feels like I've missed something easy, but I've triple
> >> checked
> >> > > the
> >> > > >> connections and config and not sure where to go from here.
> >> > > >>
> >> > > >> Thanks!
> >> > > >>
> >> > > >> Matt
> >> > > >>
> >> > >
> >> >
> >>
> >
>

Reply via email to