NebraLtd / hm-pktfwd

Helium Miner Packet Forwarder
https://nebra.io/hnt
MIT License
12 stars 24 forks source link

detect sx1303 #56

Open shawaj opened 2 years ago

shawaj commented 2 years ago

we can detect the chip being sx1303 or sx1302, can be useful for some things in the future i guess

sx1302...

root@64709de465a7:/opt/iotloragateway/packet_forwarder# /opt/iotloragateway/packet_forwarder/sx1302/util_chip_id/chip_id -d /dev/spidev0.0
CoreCell reset through GPIO17...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
INFO: using legacy timestamp
ARB: dual demodulation disabled for all SF

INFO: concentrator EUI: 0x0016c001ff1a08f0

Closing SPI communication interface
CoreCell reset through GPIO17...
shawaj commented 2 years ago

sx1303...

root@5e8978d10ca5:/opt/iotloragateway/packet_forwarder# sx1302/util_chip_id/chip_id -d /dev/spidev1.2
CoreCell reset through GPIO22...
Opening SPI communication interface
Note: chip version is 0x12 (v1.2)
INFO: using legacy timestamp
ARB: dual demodulation disabled for all SF

INFO: concentrator EUI: 0x0016c001ff1e8374

Closing SPI communication interface
CoreCell reset through GPIO22...
shawaj commented 2 years ago

Also it can be done like this... (EDIT: this was the way recommended by Semtech applications engineer so decided to use this)

The function sx1302_get_model_id() in the HAL does this

typedef enum {

CHIP_MODEL_ID_SX1302 = 0x02, /* SX1302 can be 0x00 or 0x02 */

CHIP_MODEL_ID_SX1303 = 0x03,

CHIP_MODEL_ID_UNKNOWN

} sx1302_model_id_t;
shawaj commented 2 years ago

PR upstream https://github.com/Lora-net/sx1302_hal/pull/60 In our repo ... https://github.com/NebraLtd/hm-pktfwd/pull/57

Gives following output:

sx1302 INFO: concentrator chip model ID: 0x00 sx1303 INFO: concentrator chip model ID: 0x03

shawaj commented 2 years ago

Added the chip Id detection in #57 but still need to add the python code before this can be closed - see https://github.com/NebraLtd/hm-pktfwd/pull/57#pullrequestreview-775202649 for more info there.

shawaj commented 2 years ago

FYI @marvinmarnold the RockPi versions will probably use sx1303 predominantly just in case it changes anything for #45

serbyxp commented 2 years ago

In still having an issue with SX1302 its .USB version but connected to the indoor mainboard that came with the maxiiot sx1301,

the reset_lgw.sh

I

if [ -z "$2" ]; then echo "CONCENTRATOR_RESET_PIN parameter not passed in, using value from the environment (val=${CONCENTRATOR_RESET_PIN})" else CONCENTRATOR_RESET_PIN=$2 fi

I need to change the PIN=$2 to PIN=25... and possibly switch the GPIO from pull up / to pull down

I added a line into apps.json :

"RESET_LGW_FILEPATH": "CONCENTRATOR_RESET_PIN=25"

ref

Name of envvar that reset_lgw.sh expects to contain the reset_pin value

RESET_LGW_RESET_PIN_ENV_KEY:= "CONCENTRATOR_RESET_PIN"

I dont know if its syntax, or gpio pull up / down, due to it having the USB stm32 IC it is connected the same way it came in the mPCIe card slot. not sure if im doing the config variable properly

im not sure if i need to do ...

"RESET_LGW_RESET_PIN_ENV": "CONCENTRATOR_RESET_PIN=25"

Ive emailed support but no response I dont want to reflash this, seeing as It was working and has whatever data for my miner in it...

serbyxp commented 2 years ago

maybe an option in console? or a "VARIANT:" for the type of card one would have similar to the current VARIANT env that you have for the miner type?

shawaj commented 2 years ago

@serbyxp our hardware does not support USB concentrators only SPI

serbyxp commented 2 years ago

It is not just usb , it is plugged in through spi. It just had the usb chip in it stm32 variety I am not sure if that’s an issue , I know that the lora-net sx1302_hal on mine needs to be set to reset pin 25. I been at it for 3-4 days … looking at all the flavors of miners , the only difference in your code ( I’m not a coder) I do understand “programing “ so my syntax is bad. You have the hal broken up into parts .. the part that’s messing me up is that .._concentrator_pin=$2 , and quite possibly not 100% sure a gpio pull up pull down issue. The helium packet forwarder repo doesn’t use the =$2 it actually has the pin definition called on it. I haven’t messed with the computer module 3 as far as reflashing it with my own stuff. I have it working on 3 other raspberry pies 2 model 1 and 1 pi 4b+ I been going at it making sure everything is working and everything works on gateway-rs I compiled the rust packages for the system it works, and I use the indoor main board with the compute module pulled off… and jumper wires to spi1 pins on the main board to the rpi gpio header pins and everything works. I have not attempted to plug the i2c pins of the eec ( I’m scared ) heh … but that’s my last question for you,

If I have a running working gateway and plug the i2c EEC chip as per the documentation it claims to over ride the file based swarm key. Will it populate my miners animal name and start forwarding the rewards to my wallet ?

Thank you Sean Perez

Sent from my iPhone

On Dec 21, 2021, at 7:31 PM, Aaron Shaw @.***> wrote:

 @serbyxp our hardware does not support USB concentrators only SPI

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.

shawaj commented 2 years ago

We don't support using different concentrators with our hardware I'm afraid and this is completely off topic for this thread as well.

If your concentrator has a different pinout to ours, regardless of the USB situation, you would also need to make a number of modifications including to hm-pyhelper and a variety of other repos. This is not something we support though as I said and you'd need to work it out on your own.

shawaj commented 10 months ago

See also https://github.com/Lora-net/sx1302_hal/pull/60#issuecomment-939728878