# Ability to read ADC1&2\_WIFI?

**URL:** https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727
**Category:** mangOH Red
**Created:** [September 9, 2017, 6:31pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727 "2017-09-09T18:31:25Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![coastalbrandon](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/coastalbrandon/32/264_2.png) [@coastalbrandon](https://mangoh.discourse.group/u/coastalbrandon)
#### Post date: [September 9, 2017, 6:31pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/1 "2017-09-09T18:31:25Z")

</div>

Hey guys, been having a pretty good time getting the MangOH Red going. I’m curious whether the ADC1\_Wifi and ADC2\_Wifi are available to be read? I didn’t see it in the interfaces and didn’t see it in the legato framework, but it appears available on the headers on connector CN310.  
Thanks!

---

<div class="post-metadata">

### Author: ![coastalbrandon](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/coastalbrandon/32/264_2.png) [@coastalbrandon](https://mangoh.discourse.group/u/coastalbrandon)
#### Post date: [September 10, 2017, 5:46pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/2 "2017-09-10T17:46:06Z")

</div>

Hey guys, further to the ADC I can’t seem to find any way to connect to the SPI through the wifi component. I’ve investigated the legato components and modules and saw a generic spiService, but I’m not sure how I would have it connect me through the wifi chip to my external device.

My use case is that I’m trying to connect an ADC (MCP3004), which communicates via SPI, to the RPI connector. At this point I don’t know what service I would need to use in order to communicate over those pins.

Thanks!

---

<div class="post-metadata">

### Author: ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)
#### Post date: [September 10, 2017, 10:04pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/3 "2017-09-10T22:04:07Z")

</div>

Hi Brandon,

In this case, you need to have CP2130 driver enabled in your sdef.This part is working.  
Now why do you need to use the ADC from the MTK chipset? We have not written sample code for that. Our plan for MTK is the following:  
a. End of Oct: WiFi working with documentation available  
b. End of December: Bluetooth working with documentation available  
c. End of Oct: Sample code for using gpios on MTK chipset.

regards,  
Ashish

---

<div class="post-metadata">

### Author: ![coastalbrandon](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/coastalbrandon/32/264_2.png) [@coastalbrandon](https://mangoh.discourse.group/u/coastalbrandon)
#### Post date: [September 11, 2017, 12:55am UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/4 "2017-09-11T00:55:55Z")

</div>

Hey Ashish,

I won’t need to access the ADC on the Wifi if I can get the SPI working. So the CP2130 driver will provide me access to the SPI?

---

<div class="post-metadata">

### Author: ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)
#### Post date: [September 11, 2017, 3:30am UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/5 "2017-09-11T03:30:34Z")

</div>

Yes, just uncomment out the driver in sdef file and rebuild. Note a large part (not all) of that driver was built by us and has a random startup issue. You can get started however and fix any 🐜 you find.

---

<div class="post-metadata">

### Author: ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)
#### Post date: [September 11, 2017, 2:33pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/6 "2017-09-11T14:33:30Z")

</div>

Hi,

I think you two are confusing each other 🙂

Ashish is asking why you want to use the ADC on the mt7697 because there are already ADCs on the WP. Also, there are two ways to do SPI in the mangOH Red. There is a SPI master built-in to the WP module. Also there is a CP2130 USB-To-SPI bridge chip. The purpose of the CP2130 is to provide a way for the WP to control the mt7697 (wifi + BT) chip. If you have another chip that you want to connect and control with SPI, then you would be better off connecting it to SPI1 which is available on the IoT slot.

I have written some [preliminary documentation](https://github.com/mangOH/mangOH/wiki/mangOH-Red-mt7697) which describes how to flash the mt7697, but I don’t get into how to write code for it. Based on our discussion, I don’t think you necessarily need to write any code for the mt7697 chip though.

---

<div class="post-metadata">

### Author: ![coastalbrandon](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/coastalbrandon/32/264_2.png) [@coastalbrandon](https://mangoh.discourse.group/u/coastalbrandon)
#### Post date: [September 11, 2017, 5:24pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/7 "2017-09-11T17:24:08Z")

</div>

Thanks, David.

Yeah I have been looking to build a daughter board off of the 26-pin RPI header… But perhaps as you had mentioned previously my best bet is to build a custom IoT0 daughter board. My monitoring requirements are:

ADC x 3  
Digital x 3  
UART x 1  
Send data to SD card

Since the IOT connector doesn’t have 3 ADC’s I’d have to use the SPI there with the MCP3004 (4 channel ADC). I would then use a connector to break out my signals to a phoenix style-connector on the outside of my enclosure.

If I skipped the MangOH board I could definitely just use the ADC connectors on the WP, however for the sake of speed it’s great to leverage what you guys have done so I can launch my first version of the product to my early adopters.

---

<div class="post-metadata">

### Author: ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)
#### Post date: [September 11, 2017, 5:49pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/8 "2017-09-11T17:49:54Z")

</div>

> [@coastalbrandon](#):
>
> ADC x 3
> 
> Digital x 3
> 
> UART x 1
> 
> Send data to SD card

Hi Brandon,

All of this should be available. For the 3 ADCs  
a. ADC0 on IoT card  
b. ADC1 and ADC2 on CN312

3 Digital IO on IoT card, UART on IoT card  
SD Card on board.

cheers,  
Ashish

---

<div class="post-metadata">

### Author: ![coastalbrandon](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/coastalbrandon/32/264_2.png) [@coastalbrandon](https://mangoh.discourse.group/u/coastalbrandon)
#### Post date: [September 11, 2017, 6:00pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/9 "2017-09-11T18:00:52Z")

</div>

Thanks Ashish.

I think I may have been losing my mind, when I was looking at CN312 I assumed that the ADCs were using a reference voltage of 1.8V… But now that i’m reviewing you’re just doing a direct connect to ADC1 and ADC2 on the chip. I will be looking to drop voltages down from up to 48VDC and monitoring, 1.8V would have been nasty.

---

<div class="post-metadata">

### Author: ![coastalbrandon](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/coastalbrandon/32/264_2.png) [@coastalbrandon](https://mangoh.discourse.group/u/coastalbrandon)
#### Post date: [September 11, 2017, 7:21pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/10 "2017-09-11T19:21:19Z")

</div>

Hey guys, I just read in the the WP8548 tech spec that the reference voltage is 1.8VDC for the ADCs, darnit! I may still end up using the SPI interface to MCP module since I’m monitoring such a large voltage range.

---

<div class="post-metadata">

### Author: ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)
#### Post date: [September 11, 2017, 9:27pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/11 "2017-09-11T21:27:25Z")

</div>

just use the SPI on the IoT module

---

<div class="post-metadata">

### Author: ![coastalbrandon](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/coastalbrandon/32/264_2.png) [@coastalbrandon](https://mangoh.discourse.group/u/coastalbrandon)
#### Post date: [September 11, 2017, 9:39pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/12 "2017-09-11T21:39:39Z")

</div>

For sure, thanks Ashish.

---

<div class="post-metadata">

### Author: ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)
#### Post date: [September 11, 2017, 9:49pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/13 "2017-09-11T21:49:59Z")

</div>

FYI, legato spi service should make it pretty simple to use .

---

<div class="post-metadata">

### Author: ![mccarr](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/mccarr/32/577_2.png) [@mccarr](https://mangoh.discourse.group/u/mccarr)
#### Post date: [July 30, 2018, 7:21am UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/14 "2018-07-30T07:21:26Z")

</div>

Hi @asyal,  
Any update on example code for using GPIOs on the MTK chipset?

> c. End of Oct: Sample code for using gpios on MTK chipset

---

<div class="post-metadata">

### Author: ![Francis.duhaut](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/francis.duhaut/32/350_2.png) [@Francis.duhaut](https://mangoh.discourse.group/u/Francis.duhaut)
#### Post date: [July 30, 2018, 9:53am UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/15 "2018-07-30T09:53:58Z")

</div>

And Blueetooth too 🙂

Thank you !

---

<div class="post-metadata">

### Author: ![kalaivani](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/kalaivani/32/2183_2.png) [@kalaivani](https://mangoh.discourse.group/u/kalaivani)
#### Post date: [February 25, 2021, 5:21pm UTC](https://mangoh.discourse.group/t/ability-to-read-adc1-2-wifi/727/16 "2021-02-25T17:21:10Z")

</div>

any sample code for bluetooth
