Waveshare e-Ink 2.9 and Heltec WIFI LoRa 32 V2 - esp32

I’m trying to connect mit LoRa-ESP32 with an ePaper-Display from Waveshare.
Therefore I’m using the GxEPD2 Library, but this does not work (with the library givven by waveshare the display works, but the usage is disgusting...).
Know, I don’t know if the Libraries and includes are not correct or the pin-setup. Maybe some of you already connected such a display to that ESP.
My Pin-Setup is:
GND -> GND
3.3 -> VCC
DIN -> 27 LORA_MOSI
CLK -> 5 LORA_SCK, VSPI_CSO
DC -> 15 OLED_SCL (I’m not using the onboard OLED)
CS -> 4 OLED_SDA
RST -> 16 OLED_RST
BUSY -> 36
Is this Pin-Setup useable? Do you have ideas or working includes for the Heltec ESP and GxEPD2?
Thanks
SUT

Related

Esp32 Micropython Max31865 Spi connection and data read

I need to read temperature data with using MAX31865 SPI communication. First of all, I tried to read 4 byte data:
import machine
import ubinascii
spi = machine.SPI(1, baudrate=5000000, polarity=0, phase=0)
#baudrate controls the speed of the clock line in hertz.
#polarity controls the polarity of the clock line, i.e. if it's idle at a low or high level.
#phase controls the phase of the clock line, i.e. when data is read and written during a clock cycle
cs = machine.Pin(15, machine.Pin.OUT)
cs.off()
cs.on()
data = spi.read(4)
cs.off()
print(ubinascii.hexlify(data))
I tried many times with different codes but result is always similar b'00000000'.
I am using ESP32 WROOM.
I used this pins:
ESP32 : D12 - D14 - 3V3 - GND - D15
Max31865: SDO - CLK - VIN - GND - CS
I am new on micropython and esp32.
I don't know what should I do. Is there any suggestions , recommended tutorials or idea?
Short answer: see if you can use CircuitPython and its drivers for MAX31865.
Long answer: a bunch of stuff. I suspect you've been following the Adafruit tutorial for MAX31855, but its SPI interface is very different from the MAX31865.
Your SPI connection is missing the SDI pin. You have to connect it, as communication is bidirectional. Also, I suggest using the default SPI pinout on ESP32 side as described in the micropython documetation for ESP32.
The SPI startup looks to be missing stuff. Looking at the SPI documentation a call to machine.SPI() requires that you assign values to arguments sck, mosi, miso. Those would probably be the pins on ESP32 side where you've connected SCLK, SDI, SDO on MAX31865 (note mosi means "master out, slave in" and miso is "master in, slave out").
The chip select signal on the MAX is inverted (that's what the line above CS input in the datasheet means). You have to set it low to activate the chip and high to disable it.
You can't just read data out of the chip, it has a protocol you must follow. First you have to request a temperature-to-resistance conversion from the chip. The datasheet for your chip explains how to do that, the relevant info starts on page 13 (it's a bit difficult to read for a beginner, but try anyway as it's the authoritative source of information for this chip). On a high level, it works like this:
Write to Configuration register a value which initiates the conversion.
Wait for the conversion to complete.
Read from the RTD (Resistance-To-Digital) registers to get the conversion result.
Calculate the temperature value from the conversion result.
The code might be closer to this (not tested, and very likely to not work off the bat - but it should convey the idea):
import ubinascii, time
from machine import Pin, SPI
cs = Pin(15, Pin.OUT)
# Assuming you've rewired according to default SPI pinout
spi = machine.SPI(1, baudrate=100000, polarity=0, phase=0, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
# Enable chip
cs.off()
# Prime a 1-shot read by writing 0x40 to Configration register 0x00
spi.write(b'\x00\x40')
# Wait for conversion to complete (up to 66 ms)
time.sleep_ms(100)
# Select the RTD MSBs register (0x01) and read 1 byte from it
spi.write(b'\x01')
msb = spi.read(1)
# Select the RTD LSBs register (0x02) and read 1 byte from it
spi.write(b'\x02')
lsb = spi.read(1)
# Disable chip
cs.on()
# Join the 2 bytes
result = msb * 256 + lsb
print(ubinascii.hexlify(result))
Convert result to temperature according to section "Converting RTD Data Register
Values to Temperature" in datasheet.
Side note 1: here spi = machine.SPI(1, baudrate=5000000, polarity=0, phase=0) you've configured a baud rate of 5MHz which is the maximum for this chip. Depending on how you've connected your devices, it may not work. The SPI protocol is synchronous and driven by master device, so you can set any baud rate you want. Start with a much, much lower value, maybe 100KHz or so. Increase this after you've figured out how to talk to the chip.
Side note 2: if you want your conversion result faster than the 100ms sleep in my code, connect the DRDY line from MAX to ESP32 and wait for it to go low. This means the conversion is finished and you can read out the result immediately.

Sanity Check: RS485 Communications

Alright so I am new to RS485 communications I am putting together a document for client to wire up a Atlas Copco Mark V gateway device (Protocol Converter from CAN to Modbus RTU) to a Red Lion Protocol Converter (Modbus RTU to Modbus TCP), I know its a weird setup but its the best option we had. The Modbus RTU connection between the AC Mark V and the Red Lion is over RS485. With little experience in this field and very confusing online resources I want to make sure I have this pinout correct. Alright so here is the
AC Mark V Pinout and here is the Red Lion Pinout. How I currently have it set up is Pin 3 on the Mark V (TxD/RxD+) goes to pin 7 on the Red Lion (TxB) and Pin 8 on the Mark V (TxD/RxD-) goes to Pin 8 (TxA) on the Red Lion.
Something isn't working in our communications system and I believe this is where the issue lies. We can communicate between the two systems but data isn't going through like it should be. If anyone can help confirm/deny what I did that would be very helpful. Thank you for your time.

ESP8266 + NodeMCU Custom Build + WS2812.Init() causing reset

I am trying to get some ws2812 lights to work. I am using
NodeMCU custom build by frightanic.com
branch: 1.5.4.1-final
commit: 1885a30bd99aec338479aaed77c992dfd97fa8e2
SSL: false
modules: adc,file,gpio,http,i2c,net,node,ow,rtctime,spi,tmr,uart,websocket,wifi,ws2812
build built on: 2017-05-11 11:48
powered by Lua 5.1.4 on SDK 1.5.4.1(39cb9a32)
When I execute ws2812.init() the board resets with:
> =ws2812.init()
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 24560, room 16
tail 0
chksum 0xb4
load 0x3ffe8000, len 2296, room 8
tail 0
chksum 0x09
load 0x3ffe88f8, len 136, room 8
tail 0
chksum 0x9d
csum 0x9d
I can call the ws2812.write and I see a signal on the output pin, however the timing is not correct and the lights don't work.
What am I doing wrong? This is my first ESP8266 project so i feel a bit clueless.
Thanks for any help.
Those ESP8266 chips are very picky when it comes to which pins you can use. Putting a voltage on a pin or even just connecting a sensor output during bootup can cause problems like the one you mentioned. Try not to use GPIO 0, 2 or 15 like also discussed in this post.
GPIO labels are not neccesarily the same as the pin labels on your board. So stay away from pins D3, D4 and D8.
Also when you start using the WiFi functionality even more pins become unusable. This can cause very weird behavior without proper error codes. So be aware of this. I will try to find out for you which pins you can still use when WiFi is enabled.

How to see flipflops of state machine in Quartus II

I have a circuit created by VHDL code in Quartus II. There I have a state machine. I chose the type of encoding: one-hot. I have 9 states and so I should have 9 flipflops.
Is it possible to watch how Quartus implements them on scheme? I can see only state table.
Another question is how to use the outputs of these flipflops. I need to connect them to leds but I don't know how to find them.
If it's necessary I will add my code.
You can check your state machine in Quartus this way: "Tools" -> "Netlist Viewers" -> "State Machine Viewer"
You have to connect your LED output port(s) of your top level entity to the pins on your FPGA. You have to look up in the user manual of your FPGA which pins are used for LEDs. In Quartus you can choose "Assigments" => "Assigment Editor"
Example:

Unable to connect to Atmega328P chip with 16MHz crystal

I am trying to connect to Atmega328P chip through eXtreme Burner. I used 22pf capacitors and 10K pull for reset.
I am able to read the chip if I use 8 MHz Crystal. But cannot read if I connect 16MHz crystal. When I looked at the datasheet, it says fuse bits are same for 8 MHz and 16 MHz. I get "Power On Failed" error message with 16 MHz. I am using USBASP programmer.
Please note: With 8 MHz crystal, though I am able to read the device, I get error message "Incorrect Chip Found! Continue". If I press OK, it reads the data. The fuse bits read using 8 MHz crystal are: Low-- FF, High - DE, Extended -- FD, Lock Fuse - CF and Calibration - FFFFFFB1
What could be the issue?
Attached screen shots in the link
http://www.filedropper.com/extremeburnererrors
Its not in your settings then, so it must be in the setup of your hardware. Try different capacitor values. If I remember correctly, you have to vary the value of the capacitors as the frequency of your crystal varies. Also you have to take in to account the added inductance and capacitance of the breadboard or pcb and solder. So I would suggest just trial and error with different capacitor values.

Resources