Folgen Sie den Updates auf Twitter: https://twitter.com/mistertechblog/status/1454200499247349760
Lora Backplate für Pinephone besteht aus ...
Semtech SX1262 LORA Transceiver (SPI) und Antenne
https://www.semtech.com/products/wireless-rf/lora-core/sx1262
I2C -Anschluss, der dem I2C -Anschluss (Pogo -Stifte) auf Pinephone entspricht
https://wiki.pine64.org/index.php/pinephone#pogo_pins
I2C-to-SPI-Brücke (Attiny84), der den I2C-Stecker mit dem LORA-Transceiver (SPI) verbindet.
https://github.com/zschroeder6212/tiny-i2cspi
Schema: https://wiki.pine64.org/wiki/pinedio#pinephone_backplate
Lassen Sie uns die Lora -Rückplatte mit einem Buspiraten untersuchen, einige SX1262 -Befehle übertragen und die Antworten lesen: http://dangousPrototypes.com/docs/i2c
Update: Siehe diese hervorragenden Artikel von JF ...
"Schauen Sie sich zunächst die Lora -Rückplatte für das Pinephone an"
"Die LORA -Rückplatte für das Pinephone blinkt"
"Ein Treiber für die LORA -Rückplatte für das Pinephone"
Arduino Quellcode: https://github.com/zschroeder6212/tiny-i2cspi/blob/master/src/main.c
Die Brücke läuft an der I2C -Adresse 0x28:
#include "USI_TWI_Slave.h"
#define I2C_ADDR 0x28
int main ( void )
{
/* init I2C */
usiTwiSlaveInit ( I2C_ADDR );
/* set received/requested callbacks */
usi_onReceiverPtr = I2C_received ;
usi_onRequestPtr = I2C_requested ;Die Brücke überträgt Daten an SPI, wenn das erste empfangene Byte 0x01 ist:
#define CMD_TRANSMIT 1
#define CMD_CONFIGURE 2
void I2C_received ( uint8_t bytes_recieved )
{
uint8_t command = usiTwiReceiveByte ();
switch ( command )
{
case CMD_TRANSMIT :
{
CS_PORT &= ~( 1 << CS );
for ( int i = 1 ; i < bytes_recieved ; i ++ )
{
uint8_t received_byte = SPI_transfer ( usiTwiReceiveByte ());
SPI_buffer [ received_index ++ ] = received_byte ;Wenn die Brücke einen Readbefehl empfängt, gibt sie die von SPI erhaltenen Bytes zurück:
void I2C_requested ()
{
usiTwiTransmitByte ( SPI_buffer [ transmit_index ++ ]);
if ( transmit_index >= BUFFER_SIZE )
{
transmit_index = 0 ;
}
} usi -Funktionen sind hier definiert: https://github.com/zschroeder6212/tiny-i2cspi/blob/master/src/usi_twi_slave.c
Bezogen auf:
http://dangousPrototypes.com/docs/i2c
https://lupyuen.github.io/articles/i2c#Appendix-test-bme280-with-bus-pirat
Verbinden Sie Buspiraten mit Lora Backplate:
| Bus Piratennadel | Backplate Pin |
|---|---|
MOSI | SDA |
CLK | SCL |
5V | USB-5V |
GND | GND |
Geben Sie den I2C -Modus ein, setzen Sie an:
m
I2C > HW > 400
W
Scan i2c Bus:
(1)
I2C -Scan -Ergebnisse:
Searching I2C address space. Found devices at:
0x00 (0x00 W) 0x01 (0x00
oder
Searching I2C address space. Found devices at:
0x40(0x20 W) 0x41(0x20
Problem: Buspirat hängt beim Scannen. Und die I2C -Adresse von Lora Backplate sollte 0x28 und nicht 0x00 sein. Warum?
Lesen Sie die I2C -Adresse 0x28:
[0x51 r]
(Weil 0x51 = 0x28 * 2 + 1)
Ergebnis:
I2C START BIT
WRITE: 0x51 ACK
READ: 0x00
NACK
Problem: Buspirat hängt beim Lesen der I2C -Adresse 0x28 von Lora Backplate. Warum?
Lesen Sie die I2C -Adresse 0x20:
[0x41 r]
(Weil 0x41 = 0x20 * 2 + 1)
Gleiches Problem wie oben.
Lesen Sie die I2C -Adresse 0x00:
[0x01 r]
(Weil 0x01 = 0x00 * 2 + 1)
Gleiches Problem wie oben.
Gleiches passiert, wenn wir das Breakout -Board für Lora Backplate untersuchen ...
TODO: Schreiben und lesen Sie die I2C -Adresse 0x28 Register 0x01:
[0x50 0x01 0x00] [0x51 r]
TODO: Schreiben und lesen Sie die I2C -Adresse 0x00 Register 0x01?
[0x00 0x01 0x00] [0x01 r]
Auf Pinephone mit Manjaro Phosh, scannen I2C -Bus 3 mit i2cdetect :
[manjaro@manjaro-arm ~ ]$ sudo pacman -Syu i2c-tools
[manjaro@manjaro-arm ~ ]$ i2cdetect -l
i2c-0 unknown DesignWare HDMI N/A
i2c-1 unknown mv64xxx_i2c adapter N/A
i2c-2 unknown mv64xxx_i2c adapter N/A
i2c-3 unknown mv64xxx_i2c adapter N/A
i2c-4 unknown i2c-csi N/A
i2c-5 unknown i2c-2-mux (chan_id 0) N/A
[manjaro@manjaro-arm ~ ]$ sudo i2cdetect 3
WARNING ! This program can confuse your I2C bus, cause data loss and worse !
I will probe file /dev/i2c-3.
I will probe address range 0x08-0x77.
Continue ? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- Problem: i2cdetect erfasst die I2C -Adresse (0x28) der Lora -Rückplatte nicht. Warum?
Wurde die LORA -Backplate mit der richtigen Firmware geblitzt?
I2C-to-spi Bridge auf Attiny84: https://github.com/zschroeder6212/tiny-i2cspi
Lora Backplate (I2C -Adresse 0x28) wird nicht angezeigt, wenn wir I2C -Busse 0 bis 5 scannen:
[manjaro@manjaro-arm ~ ]$ sudo i2cdetect 0
WARNING ! This program can confuse your I2C bus, cause data loss and worse !
I will probe file /dev/i2c-0.
I will probe address range 0x08-0x77.
Continue ? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: 30 -- 32 -- -- 35 -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[manjaro@manjaro-arm ~ ]$ sudo i2cdetect 1
WARNING ! This program can confuse your I2C bus, cause data loss and worse !
I will probe file /dev/i2c-1.
I will probe address range 0x08-0x77.
Continue ? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- UU -- -- -- UU -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[manjaro@manjaro-arm ~ ]$ sudo i2cdetect 2
WARNING ! This program can confuse your I2C bus, cause data loss and worse !
I will probe file /dev/i2c-2.
I will probe address range 0x08-0x77.
Continue ? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[manjaro@manjaro-arm ~ ]$ sudo i2cdetect 3
WARNING ! This program can confuse your I2C bus, cause data loss and worse !
I will probe file /dev/i2c-3.
I will probe address range 0x08-0x77.
Continue ? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[manjaro@manjaro-arm ~ ]$ sudo i2cdetect 4
WARNING ! This program can confuse your I2C bus, cause data loss and worse !
I will probe file /dev/i2c-4.
I will probe address range 0x08-0x77.
Continue ? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[manjaro@manjaro-arm ~ ]$ sudo i2cdetect 5
WARNING ! This program can confuse your I2C bus, cause data loss and worse !
I will probe file /dev/i2c-5.
I will probe address range 0x08-0x77.
Continue ? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --(Nein, es kann nicht I2C -Bus 2 sein, weil wir einen ganzen Bus erwarten, der für die I2C -Pogo -Stifte gewidmet ist)
Vergleichen Sie dies mit anderen I2C -Geräten von Pinesphone:
https://github.com/jnavarro7/pineeye_for_pinephone
https://dev.to/pcvonz/ic-on-pinephone-5090
Update: Siehe diese hervorragenden Artikel von JF ...
"Schauen Sie sich zunächst die Lora -Rückplatte für das Pinephone an"
"Die LORA -Rückplatte für das Pinephone blinkt"
"Ein Treiber für die LORA -Rückplatte für das Pinephone"