Open tcpipchip opened 1 year ago
Hi, starting now! Can you help me ?
Starting blogs https://ninab3-python.blogspot.com/2022/12/u-blox-nina-b302-rodando-tinygo.html https://ninab3-python.blogspot.com/2022/12/wisol-lsm110a-rodando-tinygo-blynk-led.html
Where to include your package and start the compile ?
├───bin ├───lib │ ├───clang │ │ └───include │ ├───CMSIS │ │ └───CMSIS │ │ └───Include │ ├───compiler-rt-builtins │ │ ├───aarch64 │ │ ├───arm │ │ ├───Darwin-excludes │ │ ├───hexagon │ │ ├───i386 │ │ ├───macho_embedded │ │ ├───ppc │ │ ├───riscv │ │ ├───ve │ │ └───x86_64 │ ├───macos-minimal-sdk │ │ ├───download │ │ ├───src │ │ │ ├───arm64 │ │ │ ├───usr │ │ │ │ └───include │ │ │ │ ├───arm │ │ │ │ ├───arpa │ │ │ │ ├───i386 │ │ │ │ ├───libkern │ │ │ │ │ ├───arm │ │ │ │ │ └───i386 │ │ │ │ ├───mach │ │ │ │ │ ├───arm │ │ │ │ │ ├───i386 │ │ │ │ │ └───machine │ │ │ │ ├───machine │ │ │ │ ├───malloc │ │ │ │ ├───protocols │ │ │ │ ├───secure │ │ │ │ ├───sys │ │ │ │ │ ├───_pthread │ │ │ │ │ └───_types │ │ │ │ ├───xlocale │ │ │ │ └───_types │ │ │ └───x86_64 │ │ └───test │ ├───mingw-w64 │ │ ├───mingw-w64-crt │ │ │ ├───def-include │ │ │ └───lib-common │ │ └───mingw-w64-headers │ │ ├───crt │ │ │ ├───sdks │ │ │ ├───sec_api │ │ │ │ └───sys │ │ │ └───sys │ │ └───defaults │ │ └───include │ │ └───sdks │ ├───musl │ │ ├───arch │ │ │ ├───aarch64 │ │ │ │ └───bits │ │ │ ├───arm │ │ │ │ └───bits │ │ │ ├───generic │ │ │ │ └───bits │ │ │ ├───i386 │ │ │ │ └───bits │ │ │ └───x86_64 │ │ │ └───bits │ │ ├───crt │ │ ├───include │ │ │ ├───arpa │ │ │ ├───net │ │ │ ├───netinet │ │ │ ├───netpacket │ │ │ ├───scsi │ │ │ └───sys │ │ └───src │ │ ├───env │ │ ├───errno │ │ ├───exit │ │ │ └───arm │ │ ├───include │ │ │ ├───arpa │ │ │ └───sys │ │ ├───internal │ │ │ ├───i386 │ │ │ └───sh │ │ ├───malloc │ │ ├───math │ │ │ ├───aarch64 │ │ │ ├───arm │ │ │ ├───i386 │ │ │ ├───mips │ │ │ ├───powerpc │ │ │ ├───powerpc64 │ │ │ ├───riscv64 │ │ │ ├───s390x │ │ │ ├───x32 │ │ │ └───x86_64 │ │ ├───mman │ │ ├───signal │ │ │ ├───aarch64 │ │ │ ├───arm │ │ │ ├───i386 │ │ │ ├───m68k │ │ │ ├───microblaze │ │ │ ├───mips │ │ │ ├───mips64 │ │ │ ├───mipsn32 │ │ │ ├───or1k │ │ │ ├───powerpc │ │ │ ├───powerpc64 │ │ │ ├───riscv64 │ │ │ ├───s390x │ │ │ ├───sh │ │ │ ├───x32 │ │ │ └───x86_64 │ │ ├───stdio │ │ ├───string │ │ │ ├───arm │ │ │ ├───i386 │ │ │ └───x86_64 │ │ ├───thread │ │ │ ├───aarch64 │ │ │ ├───arm │ │ │ ├───i386 │ │ │ ├───m68k │ │ │ ├───microblaze │ │ │ ├───mips │ │ │ ├───mips64 │ │ │ ├───mipsn32 │ │ │ ├───or1k │ │ │ ├───powerpc │ │ │ ├───powerpc64 │ │ │ ├───riscv64 │ │ │ ├───s390x │ │ │ ├───sh │ │ │ ├───x32 │ │ │ └───x86_64 │ │ ├───time │ │ └───unistd │ │ ├───mips │ │ ├───mips64 │ │ ├───mipsn32 │ │ ├───sh │ │ └───x32 │ ├───nrfx │ │ ├───doc │ │ │ ├───buildfiles │ │ │ └───config_dox │ │ ├───drivers │ │ │ ├───include │ │ │ └───src │ │ │ └───prs │ │ ├───hal │ │ ├───helpers │ │ ├───mdk │ │ ├───soc │ │ └───templates │ ├───picolibc │ │ └───newlib │ │ ├───libc │ │ │ ├───ctype │ │ │ ├───include │ │ │ │ ├───machine │ │ │ │ ├───rpc │ │ │ │ ├───ssp │ │ │ │ └───sys │ │ │ ├───locale │ │ │ ├───string │ │ │ └───tinystdio │ │ │ └───ryu │ │ └───libm │ │ ├───common │ │ └───math │ └───wasi-libc │ └───sysroot │ ├───include │ │ ├───arpa │ │ ├───bits │ │ ├───net │ │ ├───netinet │ │ ├───netpacket │ │ ├───scsi │ │ ├───sys │ │ └───wasi │ └───lib │ └───wasm32-wasi ├───pkg │ ├───thumbv6m-unknown-unknown-eabi-cortex-m0 │ │ ├───compiler-rt │ │ └───picolibc │ │ └───include │ ├───thumbv6m-unknown-unknown-eabi-cortex-m0plus │ │ ├───compiler-rt │ │ └───picolibc │ │ └───include │ └───thumbv7em-unknown-unknown-eabi-cortex-m4 │ ├───compiler-rt │ └───picolibc │ └───include ├───src │ ├───crypto │ │ ├───internal │ │ │ └───boring │ │ │ └───sig │ │ └───rand │ ├───device │ │ ├───arm │ │ ├───arm64 │ │ ├───avr │ │ ├───esp │ │ ├───kendryte │ │ ├───nrf │ │ ├───nxp │ │ ├───riscv │ │ ├───rp │ │ ├───sam │ │ ├───sifive │ │ └───stm32 │ ├───examples │ │ ├───adc │ │ ├───blinkm │ │ ├───blinky1 │ │ ├───blinky2 │ │ ├───button │ │ ├───button2 │ │ ├───can │ │ ├───caninterrupt │ │ ├───dac │ │ ├───echo │ │ ├───echo2 │ │ ├───gba-display │ │ ├───hid-keyboard │ │ ├───hid-mouse │ │ ├───i2s │ │ ├───mcp3008 │ │ ├───memstats │ │ ├───microbit-blink │ │ ├───pininterrupt │ │ ├───pwm │ │ ├───rand │ │ ├───serial │ │ ├───systick │ │ ├───temp │ │ ├───test │ │ ├───uart │ │ ├───usb-midi │ │ └───wasm │ │ ├───callback │ │ ├───export │ │ ├───invoke │ │ ├───main │ │ └───slices │ ├───internal │ │ ├───bytealg │ │ ├───fuzz │ │ ├───reflectlite │ │ └───task │ ├───machine │ │ └───usb │ │ ├───cdc │ │ ├───hid │ │ │ ├───keyboard │ │ │ └───mouse │ │ └───midi │ ├───net │ ├───os │ │ └───exec │ ├───reflect │ ├───runtime │ │ ├───cgo │ │ ├───debug │ │ ├───internal │ │ │ └───sys │ │ ├───interrupt │ │ ├───pprof │ │ ├───trace │ │ └───volatile │ ├───sync │ ├───syscall │ └───testing └───targets
your package ?
@tcpipchip this here package is for the Go programming language, not for the C SDK you are referencing.
If you want to use TinyGo with that board and this package, you can find out more from the @ofauchon video here https://www.youtube.com/watch?v=PhGiLQMHoQg
Hope that helps!
hi Yes, I know Its only gave a example that e5 is compatible LSM110A
I think the place to start is then probably adding a new board definition to TinyGo. Please see https://github.com/tinygo-org/tinygo/wiki/Adding-a-new-board#adding-a-new-board
Hi @tcpipchip ,
@deadprogram is right. Here are the main steps to run Lorawan on STM32WLxx :
Note: you 'll need to declare the correct GPIOS for the rfswitch, which is board dependant (see : https://github.com/tinygo-org/drivers/tree/dev/examples/sx126x/rfswitch)
Il you can run the lora_rxtx driver example, you'll then be able to continue with testing the lorawan stack.
Olivier
Hi, I had sent other question to a similar group, with some common users. I have already installed go and Tinygo and I can compile serial and blink examples on LSM110a. C:\tinygo\src\Tinygo flash xxxxx\examples\yyyyy How can I add the sx126x libraries and the lora example and instructions to compile ?
then I can do fast feedback
and making a lot of new blogs
https://ninab3-python.blogspot.com/2022/12/wisol-lsm110a-rodando-tinygo-blynk-led.html?m=1
this means that is it working ?
at least detected the sx1262 ?
Looks like it to me!
Thanks! I am happy!!!
need now only compile the lorawan_test.go or must to install something else before ?
please, instruct me!!! :)
Hi.
Well done, It seem you passed radio module detection step in the driver.
This means Tinygo driver could read and write SX126x registers through SPI bus. (That was the hard part ... )
Now, if you have two boards, you could flash them both with the lora_rxtx example and see if they can cross send/receive Lora frames (That would be the best way to ensure everything is OK)
If the test fails, it can be because of an external RF SWITCH in front of the STM32WL which is not properly driven (and the antennas are not RX/TX properly)
This is the reason I added an extra rfswitch code for the supported STM32WL boards (have a look to https://github.com/ofauchon/tinygo-drivers/tree/dev/examples/sx126x/rfswitch) .
Your LSI board may use different GPIOs to drive the board's RF switch.
The manufacturer SDK seems to contain RFSWITCH code: https://github.com/SeongJiIoT/LSM100A_SDK/blob/e5ee7eed74e5e11e3d06900ff9c486fc3f1d7170/Projects/NUCLEO-WL55CC/Applications/LoRaWAN_Sigfox/LSM100A/Core/Inc/radio_board_if.h#L87-L112
and :
This can help you understand how to switch between High/Low TX power mode , RX mode, and OFF (by toggling GPIOs connected to RF Switch)
You can also contact LSM board manufacturer and ask for the circuit schematics, so you can see how the RFSwitch is connected to STM32WL GPIOs
Hope that helps.
Olivier
hi @ofauchon and @deadprogram
Running two LSM110A
Right ?
Wich the next step ?
How i install your github lib and compile it ?
In meantime, i writing the BLOG, with merits to this group :)
https://ninab3-python.blogspot.com/2022/12/wisol-lsm110a-rodando-tinygo-p2p.html
Hi @tcpipchip,
You're going very fast ! That's awesome.
Thanks for the blog page. It'll help newcomers on TinyGO & Lora(WAN)
What do you want to do with Lorawan as a next step, so I can help you best. (Connecting a LoraWAN network ? which one : Public TTN or private Lorawan operator ? Sending uplink frames with sensors metrics ?)
Tell us more about your project and goals...
Thx
Hi I am not fast! 😀 Well, I have now here a dragino pointing to chirpstack, boths are working. Now I want only send “hello” using OTAA. I already have the EUI and APKKEY defined on chirpstack. My question is wich of tinygo examples I must to test and wich are the go dependencies and how to install them😀
need only test uplink for a while
send me instructions..
thank you!
Hi,
You can try to use the composter demo here:
https://github.com/ofauchon/ttn2022-tinygo/tree/main/apps/gnse-lorawan-composter
Basically, it connects a Lorawan provider, and send periodically some datas to the network
Olivier
Hi @ofauchon Must I replace the code that i tested to LoRa https://github.com/tinygo-org/drivers/tree/dev/examples/sx126x/lora_rxtx in my LSM110a GoLand project by your code above, without need more go lib dependencies ?
Need only config the LoraWAN credencies, right ?
And have you config to AU915 ?
hey
what means this error ?
Hi...
Relative path imports should not be used anymore (and considered ad bad practice) This code really needs refactoring.
But it still compiles on my setup :
Try replace "import ./extra" with "import github.com/ofauchon/ttn2022-tinygo/apps/gnse-lorawan-composter/extra". The idea is to use absolute locations to the modules.
.. There may be something different on your setup ( I can see extra "go.mod" and "go.sum", try remove them, or change import path like explained above)
You can also read https://go.dev/ref/mod to learn on how Go deal with dependencies.
Olivier
Hi I had updated to the correct image, see now Ok, I will verify
And have you config to AU915 ?
Lorawan Uplink and Downlink frequency plans is not the same in AU (compared to EU):
https://www.thethingsnetwork.org/docs/lorawan/frequency-plans/
Try to change the frequency / spread factor / ... here :
... According to AU frequency plan (uplinks)...
Then try to connect...
You should turn on radio module debug logs in your ChripStack Lorawan server to determine if the ChripStack server receive the join packet, and what downlink frequency/modulation it uses for the answers.
If uplink and downlink frequencies/modulations are different, some changes will be needed in the lorawan stack .
Worth mentioning this branch which in addition to trying to complete @ofauchon work on additional chip is also doing some config refactoring https://github.com/tinygo-org/drivers/pull/494
Btw, I have to test on LOM204a too
it´s compiles! Next Step, make comunication with CHIRPSTACK :)
some tests
accept the join, but looks that the STM32WL55 is not receiving the confirmation of JOIN
loraConf := sx126x.LoraConfig{ Freq: 916800000, Bw: sx126x.SX126X_LORA_BW_125_0, Sf: sx126x.SX126X_LORA_SF9, Cr: sx126x.SX126X_LORA_CR_4_7, HeaderType: sx126x.SX126X_LORA_HEADER_EXPLICIT, Preamble: 12, Ldr: sx126x.SX126X_LORA_LOW_DATA_RATE_OPTIMIZE_OFF, Iq: sx126x.SX126X_LORA_IQ_STANDARD, Crc: sx126x.SX126X_LORA_CRC_ON, SyncWord: sx126x.SX126X_LORA_MAC_PUBLIC_SYNCWORD, LoraTxPowerDBm: 20, }
wrong downlink frequency to AU915
923.3 - SF7BW500 to SF12BW500 (RX1) 923.9 - SF7BW500 to SF12BW500 (RX1) 924.5 - SF7BW500 to SF12BW500 (RX1) 925.1 - SF7BW500 to SF12BW500 (RX1) 925.7 - SF7BW500 to SF12BW500 (RX1) 926.3 - SF7BW500 to SF12BW500 (RX1) 926.9 - SF7BW500 to SF12BW500 (RX1) 927.5 - SF7BW500 to SF12BW500 (RX1) 923.3 - SF12BW500 (RX2)
where to modify in go code ?
Merry Christmas
Merry Christmas @tcpipchip.
The problem is here:
There is no frequency change between the Lora.Tx (the Join Packet) and the Lora.Rx (the Join Accept Receive) This was not the problem with EU regional setting, but seems required for AU operation.
You can get more informations here: https://lora-alliance.org/resource_hub/rp2-1-0-3-lorawan-regional-parameters/
Anyway, this is the reason you can't receive the Lora JoinAccept and join the network.
As a quick & dirty workaround, you can try to add some "r.radio.SetLoraFrequency(xxxxx)" in the LoraWanJoin() function to send and receive the frame at the correct frequency.
I'll have a look to the code to see how this feature can be implemented properly.
Olivier
Nice @ofauchon Maybe is better you implement and i test. It will be faster to us reach fast results. Btw i am doing in meantime the blog about LoRaWAN with lsm110a
I did try workaround… But not works @ofauchon
please share the diff so I can see what's wrong with your changes.
i only set the JOIN frequency and JOIN accept frequency values for regional values
This was not enough
OK,
Changing frequency is not enough... Your previous screenshot tells us the bandwith must be changed from 125khz to 500khz between Join and JoinAccept:
So you'll have to play with the SetModulationParams function of the driver too.
That's a bit more tricky as this SetModulationParams changes multiple parameters (coding rates, bandwidth ...)
Anyway, I hope I can fix this properly next week.
Ok! Then I will wait! Thanks for all help @ofauchon Thanks again!!!!
Hi @tcpipchip.
I opened #2 issue for the implementation of a fix for your problem. I'll tell you when I have some code ready for testing .
i have plans to test you stack in our LoRaWAN module, the LSI110A
it's is a STM32WL55+SX1262 :)