Wei1234c / Signal_Generators

Signal generators ( AD9833, AD9834, AD9850, ADF4351) tools box.
GNU General Public License v3.0
20 stars 3 forks source link

Add a schematic for AD9850 to esp32 wiring #1

Closed swaldtmann closed 3 years ago

swaldtmann commented 3 years ago

Greetings! I am trying to rebuild your setup with a ESP32 board and a HC-SR08 (ad9850).

Having a hard time to find out the correct pins and the according micropython settings.

Actually I would like to have correct pins and code for this section:

with_hardware_device = True

if with_hardware_device: _spi = peripherals.SPI.get_uPy_spi(polarity = 1) _ss = peripherals.Pin.get_uPy_pin(pin_id = 15, output = True) else: _spi = _ss = None # using None for testing without actual hardware device.

bus = peripherals.SPI(_spi, _ss) ad = AD9833(bus)

ad.reset()

for a ad9850 on a esp32

Any help is very much appreciated!

Best Regards!

Wei1234c commented 3 years ago

Sorry for late response.

First of all, ad9850.py (line: 70) was modified. Please git pull again.

For AD9850, please upload following files to ESP32:

ad98xx.py
ad9850.py
interfaces.py
register.py
peripherals.py
shift_register.py

Those files are in this repository and here.

Four pins will be needed: 15, 14, 13, 4, as stated in following code example.

Then try following:

import ad9850
import peripherals
from shift_register import ShiftRegister

_ss = peripherals.Pin.get_uPy_pin(15, output = True)
_clk = peripherals.Pin.get_uPy_pin(14, output = True)
_data = peripherals.Pin.get_uPy_pin(13, output = True)
_spi = ShiftRegister(stb_pin = _ss, clk_pin = _clk, data_pin = _data, lsbfirst = True, polarity = 1)
bus = peripherals.SPI(_spi, _ss)

_reset = peripherals.Pin.get_uPy_pin(4, output = True)
ad = ad9850.AD9850(bus = bus, pin_reset = _reset)
ad.reset()

ad.set_frequency(10.2e6)

Regards !

swaldtmann commented 3 years ago

Greetings!

Thank you for your response. Delay is not a problem at all. I appreciate your effort to help me with my hobby :-)

I struggled with line 70 in ad9850.py and found the same fix ;-)

Thank you for the pin assignment! Works great!

Best regards!