Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Itsy M0 i2c scan code inconsistant results
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Itsy M0 i2c scan code inconsistant results

by hawleyw on Sun Aug 09, 2020 8:24 pm

I am trying to hook up a sparkfun microOLED to the i2C bus of the itsyBitsy M0. The OLED works fine with an arduino (on I2c) but when I connect it to the itsy I get very inconsistent results. I am attaching the itsy to the usb port of a macBook Pro, Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit ItsyBitsy M0 Express with samd21g18.

I have tried with the following resistors on the scl/sda lines: 4.7k, 2.2k, and the two of those in series 6.9k

If I run the same code with an adafruit bme280 hooked up I get an address back on every loop, or if I have that plus the oled hooked up I get the bme address every loop and both the bme and the oled addresses every few loops.

The micro Oled's data sheet is here https://cdn.sparkfun.com/datasheets/LCD/Monochrome/Micro-OLED-Breakout.pdf

I have also tried scanning the bus via the arduino IDE/cpp and get the same, inconsistent results... unless I am doing the can with the oled attached to an arduino.
Here is what the scan code puts out:

Code: Select all | TOGGLE FULL SIZE
5:16:41.934 -> code.py output:
addresses found: ['0x3c']
20:03:57.537 -> I2C addresses found: ['0x3c']
20:03:59.529 -> I2C addresses found: []
20:04:01.557 -> I2C addresses found: []
20:04:03.537 -> I2C addresses found: ['0x3c']
20:04:05.557 -> I2C addresses found: ['0x3c']
20:04:07.573 -> I2C addresses found: []
20:04:09.575 -> I2C addresses found: ['0x3c']
20:04:11.559 -> I2C addresses found: ['0x3c']
20:04:13.573 -> I2C addresses found: []
20:04:15.566 -> I2C addresses found: []



I have been stuck on this problem for a few days now and could really use some help getting it sorted out.

hawleyw
 
Posts: 22
Joined: Mon Jan 18, 2016 4:15 pm

Re: Itsy M0 i2c scan code inconsistant results

by adafruit_support_bill on Mon Aug 10, 2020 5:43 am

Please post some photos showing your soldering and connections.

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Itsy M0 i2c scan code inconsistant results

by hawleyw on Mon Aug 10, 2020 4:01 pm

can't figure out how to attach multiple pics, so here are a few, in multiple posts.
This shot shows the itsy on its breadboard, and the microOLED plus an adafruit bme280 on a breadboard next to a sparkfun redboard. If I add the connections for the bme, it's address shows up in the loop every time and the oled shows up sporadically. Without the bme280 the oled also shows up sporadically.

Will send another up close pic of the itsy as well as the back of the oled. ... Would prefer not to pull the itsy from the breadboard because it's a bit of a pain/tight... solder joints are clear/visible from the top and the back will only show the plastic of the male headers against the board.
Attachments
itsyM0 to spakfunMicroOLED1.jpg
itsy on it's board, w/sparkfun micro oled attached (from other board). adafruit BME280 also seen.
itsyM0 to spakfunMicroOLED1.jpg (590.5 KiB) Viewed 60 times

hawleyw
 
Posts: 22
Joined: Mon Jan 18, 2016 4:15 pm

Re: Itsy M0 i2c scan code inconsistant results

by hawleyw on Mon Aug 10, 2020 4:06 pm

upclose itsy
Attachments
itsyM0 solo pic1.jpg
itsyM0 solo pic1.jpg (444.54 KiB) Viewed 59 times

hawleyw
 
Posts: 22
Joined: Mon Jan 18, 2016 4:15 pm

Re: Itsy M0 i2c scan code inconsistant results

by adafruit_support_bill on Mon Aug 10, 2020 4:08 pm

Try removing your external pullup resistors. The BME board already has pullups on-board and I would not be surprised if your OLED did also. ATSAMD21 pins don't have as much current sink capability as an UNO and too many pullups on the bus can overpower it.

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Itsy M0 i2c scan code inconsistant results

by hawleyw on Mon Aug 10, 2020 4:10 pm

back of microOLED
Attachments
IMG_5565.jpg
IMG_5565.jpg (777.68 KiB) Viewed 58 times

hawleyw
 
Posts: 22
Joined: Mon Jan 18, 2016 4:15 pm

Re: Itsy M0 i2c scan code inconsistant results

by hawleyw on Mon Aug 10, 2020 5:29 pm

adafruit_support_bill wrote:Try removing your external pullup resistors. The BME board already has pullups on-board and I would not be surprised if your OLED did also. ATSAMD21 pins don't have as much current sink capability as an UNO and too many pullups on the bus can overpower it.

Pretty sure that I’ve already tried without pull-ups But I will try again.

hawleyw
 
Posts: 22
Joined: Mon Jan 18, 2016 4:15 pm

Re: Itsy M0 i2c scan code inconsistant results

by hawleyw on Tue Aug 11, 2020 10:56 pm

Tried without pullups and found the board bricked. Mu sees a board when its in bootdrive mode but but no amount of copying over the u2f file gives me a mounting circuitpy drive, so cant get to the REPL to issue the erase_filesystem command and the troubleshooting page doesn't give me any other options...

BN: Adafruit ItsyBitsy M0
VID: 239A
PID: 000F
SN: EB4ED4BA50533336372E3120FF0D1717

Is there a way to programatically fix up the file system from within the cpp / arduino ide universe, or some other suggestion?

hawleyw
 
Posts: 22
Joined: Mon Jan 18, 2016 4:15 pm

Re: Itsy M0 i2c scan code inconsistant results

by adafruit_support_bill on Wed Aug 12, 2020 7:25 am

Let me check with our CircuitPython experts.

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Itsy M0 i2c scan code inconsistant results

by adafruit_support_carter on Wed Aug 12, 2020 10:07 am

Just to make sure we understand the current state:
  • You can upload new programs with Arduino OK?
  • You can get the board into bootloader mode OK?
  • Dragging CircuitPython firmware UF2 to bootloader folder does NOT bring back CIRCUITPY drive?

adafruit_support_carter
 
Posts: 16908
Joined: Tue Nov 29, 2016 2:45 pm

Re: Itsy M0 i2c scan code inconsistant results

by hawleyw on Wed Aug 12, 2020 11:11 am

adafruit_support_carter wrote:Just to make sure we understand the current state:
  • You can upload new programs with Arduino OK?
    Pretty sure, will check now, certainly ran the last program uploaded last night but I don't remember if I tried uploading something new
  • You can get the board into bootloader mode OK?
    Yes
  • Dragging CircuitPython firmware UF2 to bootloader folder does NOT bring back CIRCUITPY drive?

Yes

Thanks for your help, I will edit this post to let you know about the arduino ide status in 15-20 minutes; just wanted to get you the other answers in the meantime

hawleyw
 
Posts: 22
Joined: Mon Jan 18, 2016 4:15 pm

Re: Itsy M0 i2c scan code inconsistant results

by adafruit_support_carter on Wed Aug 12, 2020 11:26 am

OK, try this.

* Look at the RGB status LED and be prepared to watch it closely
  • Press the reset button once
  • The status LED will initially be "purple" but after a short period of time will turn "yellow"
  • When you see "yellow", press the reset button again (this happens fast so is tricky)

If you managed to hit the reset button the second time while the status LED is yellow, then the board should reboot into safemode. You'll see the CIRCUITPY folder show up. In Mu, if you connect to the serial output, you should see this message:
mu-safemode.jpg
mu-safemode.jpg (63.32 KiB) Viewed 39 times


If you don't, then try the reset button dance again.

Once you've gotten that message, you can press enter to get to the REPL prompt: >>>
Then you should be able to enter these commands:
Code: Select all | TOGGLE FULL SIZE
import storage
storage.erase_filesystem()

The board should then reset and be back to normal.

adafruit_support_carter
 
Posts: 16908
Joined: Tue Nov 29, 2016 2:45 pm

Re: Itsy M0 i2c scan code inconsistant results

by adafruit2 on Wed Aug 12, 2020 11:36 am

also, oleds sometimes need manual resetting. please lets just start with the BME which we have high confidence in :) power + connect just that one item.

adafruit2
Site Admin
 
Posts: 19368
Joined: Fri Mar 11, 2005 7:36 pm

Re: Itsy M0 i2c scan code inconsistant results

by hawleyw on Wed Aug 12, 2020 12:53 pm

Hooray, ish.

OK, try this.

* Look at the RGB status LED and be prepared to watch it closely
Press the reset button once
The status LED will initially be "purple" but after a short period of time will turn "yellow"
When you see "yellow", press the reset button again (this happens fast so is tricky)

If you managed to hit the reset button the second time while the status LED is yellow, then the board should reboot into safemode. You'll see the CIRCUITPY folder show up. In Mu, if you connect to the serial output, you should see this message:


This was exactly the information that I've been searching for! Please add it to the troubleshooting page; there you mention the meaning of the lights but not how to get into safe mode / deal with being unable to reach the REPL. Please also include a note that you may have to close and reopen the serial window in Mu.... Until I did this I did not see any written indication that I was in safe mode, only the yellow flashing.

The ish part is:
After storage.erase_filesystem() the REPL does not move to another prompt, it just stays there. The LED goes to green flash and code.py remains as the hello world program. If I close and reopen the serial console it does give a normal (not safe mode message)
Code: Select all | TOGGLE FULL SIZE
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit ItsyBitsy M0 Express with samd21g18


I went ahead and reconnected the bme280, loaded the i2c scan code and found it on the bus, steadily and with no trouble. I will try the oled at 1pm, incase you have input on how to go about that.

Question 1 : Is this expected? If so, it would be great to update the troubleshooting docs because they are not explicit about having to restart the serial console. In general the use of the reset button/ its secret sequences doesn't seem to be written up anywhere; double tap is explained as the way to get to the bootdrive mode, but the use of single tap, or the timing of taps to get into safe mode would be great to know... I've never been clear on whether I should be tapping reset/ ejecting/ some combo of the two when unplugging the board from my Mac in order to adjust the circuit wiring. I'll check, later, to see if there is a git repo for the "introducing-itsy-bitsy-m0" pages and open a ticket / suggest some text via a pull request.

Thanks for your help so far.

hawleyw
 
Posts: 22
Joined: Mon Jan 18, 2016 4:15 pm

Re: Itsy M0 i2c scan code inconsistant results

by adafruit_support_carter on Wed Aug 12, 2020 2:25 pm

Just to be sure - you were able to recover the board OK? What you describe generally sounds like the expected behavior. The real proof though is that things are back to "normal". Are they? (sounds like it if you were able to run i2c scan)

We're aware of the documentation issue. This process is new-ish, not meant to be secret. Docs just haven't been updated yet.

adafruit_support_carter
 
Posts: 16908
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.