ESP32 Partical

来自Jack's Lab
(版本间的差异)
跳转到: 导航, 搜索
(PIN)
(Schemmatics)
第25行: 第25行:
  
 
[[文件:Sharp.gy1010.circuit.gif]]
 
[[文件:Sharp.gy1010.circuit.gif]]
 +
 +
<br><br>
 +
 +
== Quick Start ==
 +
 +
=== Build ===
 +
 +
<source lang=bash>
 +
$ sudo apt-get install git wget make libncurses-dev flex bison gperf python python-serial
 +
$ wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-59.tar.gz
 +
$ mkdir -p toolchain
 +
$ tar zxf xtensa-esp32-elf-linux32-1.22.0-59.tar.gz -C toolchain
 +
$ export PATH=$PATH:`pwd`/toolchain/xtensa-esp32-elf/bin
 +
$
 +
$ git clone --recursive git://github.com/icamgo/esp-idf.git
 +
$ export IDF_PATH=`pwd`/esp-idf
 +
$ cd esp-idf/examples/09_adc_read
 +
$ make menuconfig
 +
$ make -j2
 +
</source>
 +
 +
<br><br>
 +
 +
=== Connections ===
 +
 +
[[文件:Quantum-adc1-1024.jpg | 600px]]
 +
 +
 +
To test the ADC pin of ESP32 on Quantum:
 +
 +
* Connect the Quantum_IO35 to 3V3 (measure the power voltage)
 +
* Connect the Quantum_IO34 to GND (measure the GND voltage)
 +
* Connect the Quantum_IO36 to GND
 +
 +
<br><br>
 +
 +
=== Upload ===
 +
 +
<source lang=bash>
 +
$ make flash
 +
</source>
 +
 +
You need to press the RST buttom after uploading the firmware into flash. If you guys do not like to do this please patch the /path/to/esp-idf/components/esptool_py/esptool/esptool.py :
 +
 +
<source lang=bash>
 +
diff --git a/esptool.py b/esptool.py
 +
index 755f4cb..ff92c91 100755
 +
--- a/esptool.py
 +
+++ b/esptool.py
 +
@@ -197,6 +197,12 @@ class ESPLoader(object):
 +
              + '\xc0'
 +
        self._port.write(buf)
 +
 +
+    def reset_to_app(self):
 +
+        self._port.setDTR(False)
 +
+        self._port.setRTS(True)
 +
+        time.sleep(0.05)
 +
+        self._port.setRTS(True)
 +
+
 +
    """ Calculate checksum of a blob, as it is defined by the ROM """
 +
    @staticmethod
 +
    def checksum(data, state=ESP_CHECKSUM_MAGIC):
 +
@@ -1421,7 +1427,6 @@ def dump_mem(esp, args):
 +
        sys.stdout.flush()
 +
    print 'Done!'
 +
 +
-
 +
def write_flash(esp, args):
 +
    """Write data to flash
 +
    """
 +
@@ -1503,6 +1508,7 @@ def write_flash(esp, args):
 +
    if args.verify:
 +
        print 'Verifying just-written flash...'
 +
        verify_flash(esp, args, header_block)
 +
+    esp.reset_to_app()
 +
 +
 +
def image_info(args):
 +
</source>
 +
 +
Then Quantum can reset to run your app automatically after uploading the firmware into flash
 +
 +
 +
=== Checking Output ===
 +
 +
<source lang=bash>
 +
$ picocom -b 115200 /dev/ttyUSB0
 +
......
 +
......
 +
</source>
  
 
<br><br>
 
<br><br>

2016年11月20日 (日) 01:36的版本

目录

1 Overview

Sharp GP2Y1010AU0F partical sensor

GP2Y1010AU0F Datasheet



2 Connections

Sharp.gy1010.pin.jpg

Sharp pin 1 (V-LED)   => 150ohm resister => Quantum_VIN_3V3
Sharp pin 2 (LED-GND) => Quantum_GND
Sharp pin 3 (LED)     => Quantum_D8_IO22
Sharp pin 4 (S-GND)   => Quantum_GND
Sharp pin 5 (Vo)      => Quantum_I36
Sharp pin 6 (Vcc)     => Quantum_VIN_3V3



3 Schemmatics

Sharp.gy1010.circuit.gif



4 Quick Start

4.1 Build

$ sudo apt-get install git wget make libncurses-dev flex bison gperf python python-serial
$ wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-59.tar.gz
$ mkdir -p toolchain
$ tar zxf xtensa-esp32-elf-linux32-1.22.0-59.tar.gz -C toolchain
$ export PATH=$PATH:`pwd`/toolchain/xtensa-esp32-elf/bin
$
$ git clone --recursive git://github.com/icamgo/esp-idf.git
$ export IDF_PATH=`pwd`/esp-idf
$ cd esp-idf/examples/09_adc_read
$ make menuconfig
$ make -j2



4.2 Connections

Quantum-adc1-1024.jpg


To test the ADC pin of ESP32 on Quantum:

  • Connect the Quantum_IO35 to 3V3 (measure the power voltage)
  • Connect the Quantum_IO34 to GND (measure the GND voltage)
  • Connect the Quantum_IO36 to GND



4.3 Upload

$ make flash

You need to press the RST buttom after uploading the firmware into flash. If you guys do not like to do this please patch the /path/to/esp-idf/components/esptool_py/esptool/esptool.py :

diff --git a/esptool.py b/esptool.py
index 755f4cb..ff92c91 100755
--- a/esptool.py
+++ b/esptool.py
@@ -197,6 +197,12 @@ class ESPLoader(object):
               + '\xc0'
         self._port.write(buf)
 
+    def reset_to_app(self):
+        self._port.setDTR(False)
+        self._port.setRTS(True)
+        time.sleep(0.05)
+        self._port.setRTS(True)
+
     """ Calculate checksum of a blob, as it is defined by the ROM """
     @staticmethod
     def checksum(data, state=ESP_CHECKSUM_MAGIC):
@@ -1421,7 +1427,6 @@ def dump_mem(esp, args):
         sys.stdout.flush()
     print 'Done!'
 
-
 def write_flash(esp, args):
     """Write data to flash
     """
@@ -1503,6 +1508,7 @@ def write_flash(esp, args):
     if args.verify:
         print 'Verifying just-written flash...'
         verify_flash(esp, args, header_block)
+    esp.reset_to_app()
 
 
 def image_info(args):

Then Quantum can reset to run your app automatically after uploading the firmware into flash


4.4 Checking Output

$ picocom -b 115200 /dev/ttyUSB0
......
......



5 Reference

For more information please refer to



















个人工具
名字空间

变换
操作
导航
工具箱