# Adafruit QT Py RP2040 (ADA4900)

**URL:** <https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882>\
**Category:** Product Questions\
**Created:** [7 May 2024 00:11 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882 "2024-05-07T00:11:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Core](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/core/32/57_2.png) [@Core](https://forum.core-electronics.com.au/u/Core)\
**Post date:** [7 May 2024 00:11 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/1 "2024-05-07T00:11:38Z")

</div>

This is a placeholder topic for [**“Adafruit QT Py RP2040”**](https://core-electronics.com.au/adafruit-qt-py-rp2040.html) comments.

![](https://core-electronics.com.au/media/catalog/product/cache/5ba536955e3e815f4e908e49c1dd8155/4/9/4900-12.jpg)

What a cutie pie! Or is it… a QT Py? This diminutive dev board comes with one of our new favorite chip, the RP2040. It’s been made famous in the new Raspberry Pi Pico and our Feather RP2040 and ItsyBitsy RP2040, but what if we wanted something really smol?

[**Read more**](https://core-electronics.com.au/adafruit-qt-py-rp2040.html)

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [7 May 2024 00:11 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/2 "2024-05-07T00:11:39Z")

</div>

Hiya.

This will be my first time working with I2C and this question is about Pinout overlap.

I’m looking at this package for a “s҉𝔦m҉𝔭l҉𝔢 𝔱w҉𝔬 𝔴e҉𝔢k҉ p҉𝔯o҉𝔧e҉𝔠t҉”

- [Adafruit 2040 Qt Py](https://core-electronics.com.au/adafruit-qt-py-rp2040.html)
- [Audio BFF](https://core-electronics.com.au/adafruit-audio-bff-add-on-for-qt-py-and-xiao.html)
- [Piicodev Display](https://core-electronics.com.au/piicodev-oled-display-module-128x64-ssd1306.html)
- [Piicodev Button](https://core-electronics.com.au/piicodev-button.html)

Having a look at the [pinout of the AudioBFF](https://learn.adafruit.com/adafruit-audio-bff/pinouts) It looks like it claims 3 for audio and 4 for SD interface.

 ![Screen Shot 2024-05-07 at 10.28.26 am](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/3/356ad43a73bf72394d8128a681f4739b03fca52b.png)

That leaves me with SDA, SCL, TX, and RX which I assume is used for serial interfacing and I2C.

**However**  
From the CE product page.

> -13 GPIO pins (11 breakout pads and two QT pads):  
> -Four 12 bit ADCs (one more than Pico)  
> -**Two I2C ports (one on the QT connector, one on the breakout pads)**  
> -SPI and UART peripherals, in standard QT Py locations,  
> -PWM outputs on every IO pin - for servos, LEDs, etc  
> -There are 6 GPIO in consecutive order for PIO compatibility

The way I read this: SDA+SCL is the first I2C and SDA1+SCL1 is the second.  
SPI and UART peripherals is referring to TX and RX.

This makes me think that I will be able to daisy the piicodev display and the piicodev button to SDA1 and SCL1 without conflict with the audio bff. (assuming I’m happy to software bash… which I am).

Can I confirm I’ve understood the docs?

Pix ❣

---

<div class="post-metadata">

**Author:** ![Michael](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/michael/32/3545_2.png) [@Michael](https://forum.core-electronics.com.au/u/Michael)\
**Post date:** [7 May 2024 01:54 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/3 "2024-05-07T01:54:00Z")

</div>

Looks good @Pixmusix

You’ll just be initialising the daisy-chainable PiicoDev hardware on I2C1, and the Audio BFF will be initialised on the SPI bus. Since the GPIO23, and GPIO22 are not reused elsewhere on the board there should be no conflicts 👍

### Two things:

Don’t confuse I2S with I2C. I2S is an audio interface. I2C is a generic, low speed data interface.

Our PiicoDev libraries are only compatible with _MicroPython_ - not _CircuitPython_, just be careful of that before you start.

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [7 May 2024 04:07 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/4 "2024-05-07T04:07:47Z")

</div>

> [@Michael](#):
>
> Looks good @Pixmusix

Great news.

> [@Michael](#):
>
> Our PiicoDev libraries are only compatible with _MicroPython_ - not _CircuitPython_, just be careful of that before you start.

No worries, I like the idea of using a higher level language like MicroPython for this project anyway.  
Speed is not essential.  
I’m choosing the RP2040 because apparently there is a micropython port for it.

### Piicodev solution?

I’m choosing the adafruit board because it’s got this BFF component that looks convenient.  
However I’d be open to a completely Piicodev solution, I’m just not sure how to handle the audio with piicodev. Is there a piicodev audio solution I should consider?  
(i think I’d like to avoid coding up PWM from scratch on this occasion).

---

<div class="post-metadata">

**Author:** ![Samuel](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/samuel/32/11763_2.png) [@Samuel](https://forum.core-electronics.com.au/u/Samuel)\
**Post date:** [8 May 2024 04:30 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/5 "2024-05-08T04:30:14Z")

</div>

Hey @Pixmusix,

Just a [PiicoDev Buzzer Module](https://core-electronics.com.au/piicodev-buzzer-v10.html) at the moment so probably not super useful for your project. This is not a bad idea for a module however and would fit well into the PiicoDev line-up.

I will pass this up and we may potentially do something like this in the future.

Hope this helps!  
Sam

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [30 May 2024 12:40 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/6 "2024-05-30T12:40:12Z")

</div>

@Michael I’m redirecting to this thread. 🙂  
Linking from the below because this isn’t really relevant to that guide any more.

> [@Guide by Brenton; Makerverse Micro SD Adapter - MicroPython Guide and Data Logging](https://forum.core-electronics.com.au/t/guide-by-brenton-makerverse-micro-sd-adapter-micropython-guide-and-data-logging/14670/19):
>
> It might be time for the sanity check - can you upload some photos of how things are connected, and also tell us what format + size the SD card is?

#### My build chain

[![](https://img.youtube.com/vi/0Hy1qNaey18/maxresdefault.jpg "ce audiobff buildchain") ](https://www.youtube.com/watch?v=0Hy1qNaey18)

#### Here is the guide I’m following.

[https://git.emacinc.com/micropython-public/micropython-i2s-examples/-/blob/emac-support/examples/easy\_wav\_player.py](https://git.emacinc.com/micropython-public/micropython-i2s-examples/-/blob/emac-support/examples/easy_wav_player.py)

#### I have had to swap to a different SD card library since the code above no longer works.

> [@Micropython Machine Module and SD cards](https://forum.core-electronics.com.au/t/micropython-machine-module-and-sd-cards/20060/2):
>
> Hey Pixmusix, From what I can tell from the code used in this link they are using a big if/else statement to determine what board is being used before they import the required library. Looking at the documentation for SD card use in MicroPython I think this library call method is incorrect. I think it should be import os import machine import sdcard With ‘sdcard’ being called in lowercase and as a separate library. The documentation at the below link made sense to me, hopefully you can m…

#### Here is the wrapper around the guide above.

```python
### THIS NEEDS TO BE A CLASS

from wavplayer import WavPlayer
import os
from machine import Pin, SPI, I2S
import sdcard

def play():
    wp.play("hello.wav", loop=True)
    return is_playing()

def pause():
    wp.pause()
    
def resume():
    wp.resume()
    
def is_playing():
    return wp.isplaying()
    
    
# ======= SD CARD CONFIGURATION =======
#sd = SDCard(slot=1, sck=Pin(6), mosi=Pin(3), miso=Pin(4), cs=Pin(29))
sd_pin = Pin(29)
sd_spi = SPI(0)
sd = sdcard.SDCard(sd_spi, sd_pin)
os.mount(sd, "/sd")

# Read files from SD card
print("my list:")
for filename in os.listdir("/sd"):
    print(filename)

# Init Audio
'''
    A1 - This is used for audio data, or DAT.
    A2 - This is used for wordselect clock, or LR.
    A3 - This is used for bitclock, or BCLK.
'''
audio_clk_pin = Pin(26)
audio_word_pin = Pin(27)
audio_data_pin = Pin(28)

#Construct the wp
wp = WavPlayer(id=0, sck_pin=Pin(audio_clk_pin), ws_pin=Pin(audio_word_pin), sd_pin=Pin(audio_data_pin), ibuf=44100)

```

#### Here is the offending code.

```python
play() #<----
while is_playing():
    if button.is_pressed:
        pause()

```

#### Goal

It’s all feeling like I’m on the wrong path entirely in terms of my build chain.  
I will entertaining loading from SD onto flash first and reading from flash. 🙂  
Nothing here is real time. 99% of the time this chip will be idle so I have plenty of time of read-write blocking code.

Thanks.  
Pix ❣

---

<div class="post-metadata">

**Author:** ![Jack](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/jack/32/9287_2.png) [@Jack](https://forum.core-electronics.com.au/u/Jack)\
**Post date:** [31 May 2024 02:35 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/7 "2024-05-31T02:35:19Z")

</div>

Hi Pix,

What a deep dive we are getting ourselves into. You managed to get some noise out so surely we can get the right noise out. I want to completely rule out hardware as an issue first. From what I’ve gathered the button and the display you have gotten working. This leaves the [Audio BFF](https://core-electronics.com.au/adafruit-audio-bff-add-on-for-qt-py-and-xiao.html) and the speaker.

If you haven’t already can you try either the [CircuitPython](https://learn.adafruit.com/adafruit-audio-bff/circuitpython) or [Arduino](https://learn.adafruit.com/adafruit-audio-bff/arduino) examples. The Arduino scripts are said to have been tested with the QT Py RP2040 and the library has been updated in the last year for those boards so hopefully that won’t be too difficult. It may be easier than the CircuitPython example.

Could you also confirm that your [SD card is still formatted to FAT32](https://forum.core-electronics.com.au/t/micropython-machine-module-and-sd-cards/20060/6)?

> [@Pixmusix](#):
>
> #### Here is the offending code.
> 
> ```auto
> play() #<----
> while is_playing():
> if button.is_pressed:
> pause()
> 
> ```

Was there another issue present with this section?

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [31 May 2024 03:01 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/8 "2024-05-31T03:01:54Z")

</div>

> [@Jack](#):
>
> Could you also confirm that your [SD card is still formatted to FAT32](https://forum.core-electronics.com.au/t/micropython-machine-module-and-sd-cards/20060/6)?

Sd card is Fat32 🙂

> [@Jack](#):
>
> The Arduino scripts are said to have been tested with the QT Py RP2040 and the library has been updated in the last year for those boards so hopefully that won’t be too difficult.

Ah! I have also tried this.  
I claim the [Arduino script here](https://learn.adafruit.com/adafruit-audio-bff/arduino) doesn’t compile.

Here is a screen shot message.  
I think I’ve got all the correct libraries installed.

```auto
Using library SdFat - Adafruit Fork at version 2.2.3 in folder: C:\Users\optim\Documents\Arduino\libraries\SdFat_-_Adafruit_Fork 
Using library SPI at version 1.0 in folder: C:\Users\optim\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.16\libraries\SPI 
Using library Adafruit Zero DMA Library at version 1.1.3 in folder: C:\Users\optim\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.16\libraries\Adafruit_ZeroDMA 
Using library Adafruit WavePlayer Library at version 1.0.7 in folder: C:\Users\optim\Documents\Arduino\libraries\Adafruit_WavePlayer_Library 
Using library I2S at version 1.0 in folder: C:\Users\optim\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.16\libraries\I2S 

```

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/6/6ea97d7628bcdfd4d20c60fd4a68308a302da7cd.png)

Here is the error message it gives me.

```auto
exit status 1

Compilation error: 'I2S' does not name a type

```

and I took the time to push out the verbose stack.

```auto
C:\Users\optim\Documents\Arduino\Flower_BFF\Flower_BFF.ino:10:1: error: 'I2S' does not name a type
   10 | I2S i2s(OUTPUT); // I2S peripheral is...
      | ^~~
C:\Users\optim\Documents\Arduino\Flower_BFF\Flower_BFF.ino: In function 'void setup1()':
C:\Users\optim\Documents\Arduino\Flower_BFF\Flower_BFF.ino:69:3: error: 'i2s' was not declared in this scope; did you mean 'I2s'?
   69 | i2s.setDATA(pDOUT);
      | ^~~
      | I2s
C:\Users\optim\Documents\Arduino\Flower_BFF\Flower_BFF.ino: In function 'void loop1()':
C:\Users\optim\Documents\Arduino\Flower_BFF\Flower_BFF.ino:104:7: error: 'i2s' was not declared in this scope; did you mean 'I2s'?
  104 | i2s.write((int32_t)sample.channel0 - 32768);
      | ^~~
      | I2s
C:\Users\optim\Documents\Arduino\Flower_BFF\Flower_BFF.ino: In function 'void play_i2s(File)':
C:\Users\optim\Documents\Arduino\Flower_BFF\Flower_BFF.ino:120:9: error: 'i2s' was not declared in this scope; did you mean 'I2s'?
  120 | if (i2s.begin(rate)) {
      | ^~~
      | I2s
Multiple libraries were found for "Adafruit_ZeroDMA.h"
  Used: C:\Users\optim\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.7.16\libraries\Adafruit_ZeroDMA
  Not used: C:\Users\optim\Documents\Arduino\libraries\Adafruit_Zero_DMA_Library

```

This error makes sense to me.  
This is such a weird line of c++ code.  
`OUTPUT` is as far as I can tell undefined. It does not appear anywhere else in the INO.  
That would imply it’s in a header file or linker which is bizarre (but it’s c++ so… anything is possible). Also that comment is absolutely wild. People who put a trailing ellipse on a comment truly want to see the world burn. 😛

```auto
I2S i2s(OUTPUT); // I2S peripheral is...

```

So I2S is apparently not a type at all which might suggest the linker can’t find the library header files, but if that was the case you would think the linker would throw an error as well.

```auto
#include <I2S.h> // << Why didn't this throw and error??

```

At this point I gave up, figuring one rabbit hole to focus on was enough 😛  
I’m open to debugging the Arduino code if you strongly suspect the hardware.  
It would be nice to see it working. This is my first time playing with Is2 so maybe there is an obvious fix? Any thoughts?

> [@Jack](#):
>
> Was there another issue present with this section?

No the code largely runs, the audio is just terrible. I find that unsurprising given that I’ve had to swap SD card library and then run surgery inside the library to get it to read.

---

<div class="post-metadata">

**Author:** ![Jack](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/jack/32/9287_2.png) [@Jack](https://forum.core-electronics.com.au/u/Jack)\
**Post date:** [31 May 2024 05:18 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/9 "2024-05-31T05:18:52Z")

</div>

While I don’t have the audio BFF I do have the QT Py. The board IDE is looking for should be the Adafruit QT Py RP2040. The I2S library may be board specific.  
Give that a go and we’ll start tackling the MicroPython.

> [@Pixmusix](#):
>
> This is my first time playing with Is2 so maybe there is an obvious fix?

Most obvious fixes are only obvious in hindsight

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [31 May 2024 05:26 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/10 "2024-05-31T05:26:27Z")

</div>

Are you saying I should have a board displayed called “Adafruit QT Py RP2040” precisely?

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/5/55a3ea05e247c58e41ca275dce767c5988fde385.png)

That board doesn’t come up in the board manager  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/4/444f9a56ced8a3e8f926c9510b530e29368b1633.png)

![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/2/2f73f0ee84ae0fe24bba57ef024aafeb9b311240.png)

I found this.  
Let me try it.

> **[Adafruit QT Py RP2040](https://learn.adafruit.com/adafruit-qt-py-2040/arduino-ide-setup)**
>
> What a cutie pie! Or is it... a QT Py? This diminutive development board comes with one of our new favorite chips, the Raspberry Pi RP2040. A new chip means a new QT Py, and the RP2040 is no exception.

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [31 May 2024 05:38 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/11 "2024-05-31T05:38:41Z")

</div>

OK good call Jack.  
I thought I had the right board installed but I it was just a look-alike.  
Must have missed a step the first time.

I can’t upload the code.

```auto
Converting to uf2, output size: 178688, start address: 0x2000
Scanning for RP2040 devices
Unable to build drive list
Failed uploading: uploading error: exit status 1

```

I think it’s because I have already installed micro python.  
Does thonny have an easy uninstall feature I could use?

> **[Adafruit QT Py RP2040](https://learn.adafruit.com/adafruit-qt-py-2040/downloads)**
>
> What a cutie pie! Or is it... a QT Py? This diminutive development board comes with one of our new favorite chips, the Raspberry Pi RP2040. A new chip means a new QT Py, and the RP2040 is no exception.

It could be other things too. I’ll have a google around.  
Maybe a PC thing? I’ll try some other computers tonight too tonight.

---

<div class="post-metadata">

**Author:** ![Jack](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/jack/32/9287_2.png) [@Jack](https://forum.core-electronics.com.au/u/Jack)\
**Post date:** [31 May 2024 06:07 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/12 "2024-05-31T06:07:01Z")

</div>

I am using a different boards manager all together.  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/1/14fa3ec36e27acc54ba803899ab02e051b06c833.png)  
It also includes all the QT ESP32 boards  
 ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/6/652c650a3ee24f7385d98946e245684b04222111.png)

We’ll be working backwards a bit if we keep pursuing this way I think. [Adafruit has a page on UF2](https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/uf2-bootloader-details#uf2-bootloader) which is the format the RP2040 uses. Bootloader mode may help. Hold the boot button when plugging it into the USB-C cable. The test board I have here wasn’t recognised until I did that.

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [31 May 2024 06:14 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/13 "2024-05-31T06:14:32Z")

</div>

> [@Jack](#):
>
> We’ll be working backwards a bit if we keep pursuing this way I think

Hi Jack.  
I’m not sure I know what this means.  
Are you saying I’m approaching this wrong? 🤷‍♂️ 🙂

---

<div class="post-metadata">

**Author:** ![Jack](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/jack/32/9287_2.png) [@Jack](https://forum.core-electronics.com.au/u/Jack)\
**Post date:** [31 May 2024 06:16 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/14 "2024-05-31T06:16:29Z")

</div>

If you intend to use Thonny in the end it may be more hassle to get the board working on the Arduino IDE then come back to Thonny.

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [31 May 2024 06:23 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/15 "2024-05-31T06:23:03Z")

</div>

I’m happy to spend the time making this work in C++.  
A working example will be a breath of fresh air.  
Who knows, It might be easy to get the Piicodev Button and the OLED working in C++ than it is to get the QT Py working in Micro-python.  
Does the piicodev stuff work with adafruit libs?  
Thanks for your support btw.

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [31 May 2024 06:32 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/16 "2024-05-31T06:32:12Z")

</div>

> **[Problem uploading Sketch to Raspberry Pico RP2040 in Arduino IDE – “Unable to...](https://samuelpinches.com.au/hacking/problem-uploading-sketch-to-raspberry-pico-rp2040-in-arduino-ide-unable-to-build-drive-list/)**
>
> So you bought a Raspberry Pico, hoping to upgrade your Arduino workflow to 32 bit, but you ran into problems almost immediately? Join the club… When I tried to upload a simple sketch, I got a…

This champion had my answer.

After that I hit more errors but this uf2 resets the board and fixed my problem.  
[https://cdn-learn.adafruit.com/assets/assets/000/102/078/original/QT\_PY\_RP2040.uf2?1620747620](https://cdn-learn.adafruit.com/assets/assets/000/102/078/original/QT_PY_RP2040.uf2?1620747620)

We got this working.  
**Playing good quality audio.** 🥳

@Jack Thanks for giving me the encouragement to look back into the Arduino IDE route. It was a good idea and I gave up too quickly the first time.

A big part of my goal with this project was to learn micropython.  
Now that we have ruled out hardware, Is there anything avenues I have to get audio working there?

---

<div class="post-metadata">

**Author:** ![Liam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam/32/3562_2.png) [@Liam](https://forum.core-electronics.com.au/u/Liam)\
**Post date:** [31 May 2024 06:49 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/17 "2024-05-31T06:49:22Z")

</div>

Hi Pix,

Taking one step back from the Qt Py RP2040, its just a Pico!

> [@Pixmusix](#):
>
> That board doesn’t come up in the board manager  
> ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/4/444f9a56ced8a3e8f926c9510b530e29368b1633.png)

The SAMD is a different processor entirely but also features in a QT Py form factor (Same as the Xiao)

> [@Pixmusix](#):
>
> Who knows, It might be easy to get the Piicodev Button and the OLED working in C++ than it is to get the QT Py working in Micro-python.

Maybe, though drivers would have to be developed. But all of that is open source so should be convertible given enough time/knowledge/GPT tokens.

> [@Pixmusix](#):
>
> Does the piicodev stuff work with adafruit libs?

The OLED will being a SSD1306 but the button is running bespoke code and from the outside, interacts over I2C like any other device - but with a microcontroller between the main controller and end peripheral (button in this case).

> [@Pixmusix](#):
>
> A big part of my goal with this project was to learn micropython.  
> Now that we have ruled out hardware, Is there anything avenues I have to get audio working there?

Unfortunately without a driver for the specific chip on that module it will be hard and again a lot of porting.

Hope that answered at least some of your questions 😅  
Liam

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [31 May 2024 07:01 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/18 "2024-05-31T07:01:33Z")

</div>

Thanks Liam.

Thanks for answering all those questions.

> [@Liam](#):
>
> the button is running bespoke code and from the outside, interacts over I2C like any other device - but with a microcontroller between the main controller and end peripheral (button in this case).

Can you break this down a little bit for me I didn’t understand. 🙂

---

<div class="post-metadata">

**Author:** ![Michael](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/michael/32/3545_2.png) [@Michael](https://forum.core-electronics.com.au/u/Michael)\
**Post date:** [31 May 2024 07:16 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/19 "2024-05-31T07:16:54Z")

</div>

@Pixmusix If you want to use the button with Arduino code, you can treat the PiicoDev button line ~~any other~~ a quirky I2C device. Truly a freaky little guy.

The register map is here in the README.md of the [firmware repo](https://github.com/CoreElectronics/CE-PiicoDev-Switch-MicroPython-Module).

You’re probably after the `is_pressed` and `was_pressed` registers which are 0x11 and 0x12

* * *

### Why freaky?

You can ignore the _second_ register number that is assigned to some registers - this is a quirk for _writes_ to the register, which does not apply to the button state readonly registers.

For example  
If you wanted to read the status of the LED, you would read from 0x05  
If you wanted to _write_ the state of the LED, you would write to 0x85

This isn’t at all how other i2c devices work, but it’s a quirk of how I’ve implemented an I2C device using the arduino i2c library. This strange behaviour would be completely concealed by the MicroPython driver that we intend the device to be used with, but if you’re braving doing this from scratch, this is useful to know 😉

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [3 June 2024 01:08 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/20 "2024-06-03T01:08:20Z")

</div>

> [@Michael](#):
>
> You’re probably after the `is_pressed` and `was_pressed` registers which are 0x11 and 0x12

@Michael, so helpful as always! Seeing that table and reading this post made i2c protocol _click_ for me.

Quick clarifying question.

The below code is feeding me data, but it the data is slow and doesn’t seem to correspond to button presses.  
The bytes coming back are -0x1(-1) and 0x40(64).  
64 is 0b1000000 and -1 (assuming two’s compliment) is 0b00000001. I’m starting to wonder if the piicodev is little endian but `wire.h` is expecting big endian? Are there any quirks in reading the bytes I need to be aware of?

```auto
bool button_is_pressed() {
  byte dat = 0x00;
  Serial.print("Requesting ");
  Wire1.requestFrom(0x11, 1);
  dat = Wire1.read();
  Serial.println(dat);
  return dat > 0;
}

/* Serial 
Requesting 64
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting -1
Requesting 64
*/

```

(Alternatively it may be my code is just wrong and that’s why the data is coming back so course).

[Next page](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882.md?page=2)
