Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 15 of 15

Thread: Connecting Prop Shield to ESP32 Feather via Feather Wing

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    18

    Connecting Prop Shield to ESP32 Feather via Feather Wing

    I recently picked up an ESP32 feather (https://learn.adafruit.com/adafruit-...eather/pinouts), and want to try hooking it up to a Prop Shield via a feather wing adapter (https://www.adafruit.com/product/3200). I had a few questions on the wiring though. For reference, this is the schematic for the adapter:

    https://raw.githubusercontent.com/ad.../schematic.png

    I had a few questions specifically:
    1) AGND doesn't appear to go anywhere. Is it necessary for me to bring it out to anything on the ESP32?
    2) What exactly is AREF? The ESP32 marks the pin that connects to as NC.
    3) I believe I need to connect Pin 7 (LED_EN) and Pin 2 (IRQ) on the prop shield to some pin on the feather. Is there anything I should pay particular attention to when selecting this pin? All of the pins on the ESP32 connect to something on the Prop shield, so I didn't want to cause any problems by doing that.

    For #3, I'm thinking of
    1) Jumping Pin 20 (A6) with Pin 7 (LED_EN), so that I can use A5 to enable the LEDs.
    2) Jumping Pin 14 (A0) with Pin 2 (IRQ), so that I can get motion sensor interrupts.

    I did pick up a Teensy 3.2 as well, so I can always fall back to that. I was hoping to avoid having an external BLE device, so I figured I'd try the ESP32 first.

    Any thoughts on whether that would make sense, and whether there is anything I need to do about AGND would be greatly appreciated!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    For some of these questions, you're going to need to refer to the schematic to see how things really connect.

    https://www.pjrc.com/store/prop_shield.html


  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Now, regarding some of those specific questions...

    AREF isn't actually used, as you can see in the schematic, so you don't need to worry about that one.

    AGND is indeed used. You can probably just connect it to regular GND. This really is only used for the DAC, and which pin on ESP32 you would use, I have no idea. I don't know much about ESP, but if it has a DAC you would need to connect that signal to the DAC/A14 pin... if you want to use the audio amp part of the shield. Otherwise, it doesn't matter if you leave the DAC pin and AGNG pins unconnected. The audio amp stays in low power shutdown until you drive pin 5 high. Driving it low or just leaving it unconnected (thanks to the two 47K resistors) means the amp will remain disabled.

    You can also see in the schematic those 3 motion sensors use 3 signals. But most libraries for them only use SDA & SCL. If you are using a library which needs the IRQ signal, then you'll need to figure out which pin the library requires. I can tell you the library I wrote (which hasn't been tested on any ESP chips) doesn't use the IRQ signal at all.

    The LED enable can be used with any digital pin. Or you can just wire it to 3.3V if you want the LED signals to always output. Of course if you access the SPI flash chip, or connect other SPI devices to those same pins, you'll want to make sure the LEDs are not driven with the SPI communication for the non-LED devices.

  4. #4
    Junior Member
    Join Date
    Dec 2017
    Posts
    18
    Great, thanks for the info. I was afraid I'd need to connect AGND to something. I thought I read a thread on here that said connecting a battery's negative terminal to AGND could cause problems. From the schematic linked above, it looks like the feather wing connects the battery's negative terminal to GND. Is it still safe to connect AGND to GND in this case? Or is there some alternative (like connecting to another pin driven low?)

    Luckily from a DAC standpoint, the feather adapter brings out A14/DAC to A0, which is the ESP's DAC2. So hopefully that should work fine.

    Good to know on the IRQ. I wasn't sure if it was really needed (I hadn't originally planned to use it, but figured I'd look into whether the library supported it later). I planned to use whatever the prop shield examples showed, so it sounds like there's no need to hook up the IRQ at this time.

    Since I plan to use the built-in SPI flash, it sounds like I should be fine with hooking up Pin 7 as described above. Regarding SPI flash, I assume all I need to do is make sure the pins defined in the teeensytransfer.ino are correct, and I should be able to use teensytransfer just fine. Are there any other gotchas I should be aware of? It looks pretty straight forward, but I figured I'd check just in case.

  5. #5
    Senior Member
    Join Date
    Jan 2013
    Posts
    145
    Quote Originally Posted by marsthrax View Post
    Is there anything I should pay particular attention to when selecting this pin? All of the pins on the ESP32 connect to something on the Prop shield, so I didn't want to cause any problems by doing that.
    "Some pins are special about the ESP32 [Feather]".

  6. #6
    Junior Member
    Join Date
    Dec 2017
    Posts
    18
    Quote Originally Posted by markonian View Post
    Thanks for the link. I did see that. I was more referring to whether or not there was some issue with jumping the above pins that I wasn't aware of (I'm not as much of a hardware person, mostly just learning that). The only issue that seems to stand out is that IO12 on the ESP32 is generally recommended to not be used, but it is connected to the MEM_CS. However, it does say that should be configured as an OUTPUT, which seems to be consistent with using it as a CS pin.

  7. #7
    Junior Member
    Join Date
    Dec 2017
    Posts
    18
    Quote Originally Posted by PaulStoffregen View Post
    For some of these questions, you're going to need to refer to the schematic to see how things really connect.

    https://www.pjrc.com/store/prop_shield.html

    I'm not having much luck interfacing with anything on the prop shield (tried APA102 and motion sensors so far), although I think I have things hooked up correctly. Right now I'm trying to just work with the motion sensors. It turns out I can't use the NXPMotionSense library because it depends on util/crc16, which apparently is only available for Teensy (I looked at the file, and it has assembly in it, so I didn't bother going any further). I tried using the Adafruit libraries (such as Adafruit_FXAS21002C). That compiles and starts to run, but it fails to detect the gyroscope. From the diagram above, it looks like I shouldn't have to worry about the pullup resistors. Is there another reason the Adafruit library wouldn't work with the prop shield through the ESP32? Would I be better of trying to port over the NXPMotionSense library?

  8. #8
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,571
    there is no assembly in hardware/teensy/avr/cores/teensy3/util/crc16.h so you should be able to copy that into your sketch folder

  9. #9
    Junior Member
    Join Date
    Dec 2017
    Posts
    18
    Quote Originally Posted by manitou View Post
    there is no assembly in hardware/teensy/avr/cores/teensy3/util/crc16.h so you should be able to copy that into your sketch folder
    Ah, you're right. I was apparently looking at /usr/avr/include/util/crc16.h. I was able to copy over the one from teensy (along with ellapsedMillis.h), and it the calibration example worked as expected. Thanks!

  10. #10
    Junior Member
    Join Date
    Dec 2017
    Posts
    18
    Alright, so good news: I finally found a configuration that lets me use the NXPMotionSensors and the APA102 output, which is awesome.
    Bad news: I'm not sure how to progress using the amp and the built in SPI flash. They seem to use very Teensy specific libraries. I can probably either hook up the prop shield to a Teensy for getting TeensyTransfer up and running and load files up quickly (long term I'll need bluetooth or wifi to upload files, but that is a project for another day). Unfortunately, it looks like I'll run into similar issues once I get to using the Audio library. Is it feasible to use the Audio library to read from the SPI flash without a Teensy, or would I probably need to roll my own way of doing that? If I have to do my own, what should I look into in order to support asynchronous payback (I plan to have a sound file playing on loop while I check the status of sensors, handle wireless, etc).

    One thought I had was trying to make my own version of kinetis.h, and hope that was all I really needed to worry about. Is that true? If so, is there documentation somewhere on what the various defines mean? It looks like many of them are pin definitions, but I haven't delved too deeply into it yet.

  11. #11
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,571
    I have only done limited testing with the Sparkfun ESP32 thing, I think using the Teensy audio library will be a show-stopper. You should be able to do some simple tests with the SPI flash, the teensy SerialFlash library only uses generic SPI commands to read/write blocks, and the light-weight file system sits on top of the SPI block transfers. And you should be able to make sounds by say generating a sine wave through one of the ESP32 DACs (only 8 bit) hooked to the AudioIn of the prop shield and with the amp pin (5) HIGH. Using Teensytransfer is unlikely as it uses USB HID logic that is probably not available via the ESP32 API. But you could transfer binary data blocks with the ESP32 Wifi and use the SerialFlash library to create files on the SPI flash. The teensy Audio library when using AudioOutputAnalog (the DAC) uses timer-controlled DMA to drive the DAC at 44khz -- again unlikely you can make that happen on the ESP32.

    Making your own version of kinetish.h will not be helpful.

    you have years of ESP32 work ahead of you, and your ESP32 questions should be directed to an ESP32 forum. good luck.

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Quote Originally Posted by marsthrax View Post
    Is it feasible to use the Audio library to read from the SPI flash without a Teensy,
    No, not really feasible. There are many libraries which read from SPI flash chips, particularly SPIFFS on ESP.

    For playing audio, you're almost certainly going to need to find a library that's designed for ESP. Many libs are very portable between boards, because they access hardware though libraries like SPI & Wire, or using the Arduino functions like digitalWrite(). NXPMotionSensors is one of those "easy" cases where everything is done through Wire, so the problems on other boards are fairly simple to solve. But Teensy's audio lib makes very heavy use of Teensy-specific peripherals. It also uses the ARM Cortex-M4 DSP extension instructions, which don't even exist on smaller ARM chips, not to mention the non-ARM processor found in ESP. Porting it to a different board would be extremely hard.

    The good news at least is that audio amp on the prop shield doesn't have any special software requirements, at least beyond a single digitalWrite() to cause it to power up. Once it's enabled, it just amplifies whatever analog signal you give it. In fact, you could even use something like the headphone output from a phone or tablet to drive its analog input pin. So my advice would be to look for a library for ESP or maybe even other hardware that can generate an analog audio signal.

  13. #13
    Junior Member
    Join Date
    Dec 2017
    Posts
    18
    manitou, Paul,

    Yea, that's what I was a little afraid of, but after digging a little more last night it's pretty much what I expected. I hadn't looked too closely at SPIFFS yet, I'll be sure to do that. I've found a few examples of people using I2S on the ESP32 to write to the DAC, so I'll probably play with that as well and see if I can get it running either via timers or in a separate task. Good point on transferring the data over Wifi. I had thought of that, but figured just hooking it up temporarily to a teensy would probably be easier just to load up the sample files (later on, I will definitely want a wireless mechanism for getting the sound fonts over to the device). I'll probably keep playing with the ESP for a little while, but can always switch to the Teensy if I don't make much headway. This was more of an experiment in jumping off the deep end anyways=).

    Thanks for all the help, I definitely appreciate it!

  14. #14
    Junior Member
    Join Date
    Dec 2017
    Posts
    18
    I've managed to get sound working with the ESP32 through the prop shield. There were a few false starts, but I'm able to use the ESP32's built-in I2S interface to play MP3s through the DAC, which is great. I have found that I don't strictly need to connect AGND to GND, but the sound is definitely quieter without connecting AGND to GND. For my purposes, I might be able to get away with not connecting AGND to GND, but is there any other reason I should make sure I keep that connection?

    The big issue I'm having is with a hum. There is always a small hum (it is noticeably louder with AGND connected to GND, and much louder when I am powering the APA102 string). I haven't done much hardware before, but I've read it could either be a ground loop or just noise induced by the LEDs. Is there a way I can filter out the hum? It would be easiest if I could do all of that on the LED end (just because of the form factor I am working with), but I'm open to any suggestions.

  15. #15
    Junior Member
    Join Date
    Dec 2017
    Posts
    18
    I looked at the Teensy 3.2 schematic, and took a stab at a schematic for the circuit to isolate AGND and filter out the noise. I honestly have no idea if this is correct, or if it could be simplified for my use case. I'm also not sure about values for the inductors, or if there is a simple breadboard mountable inductor I could use for testing the circuit. Any thoughts/comments, or pointers to resources I should consider would be greatly appreciated!

    Click image for larger version. 

Name:	AGND Filter.png 
Views:	29 
Size:	3.3 KB 
ID:	12838

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •