nopnop2002 / Arduino-LoRa-Ra01S

An Arduino Library for LoRa Communication using SX1262/1268
MIT License
29 stars 10 forks source link

Migration to Attiny #5

Closed garudaonekh closed 1 year ago

garudaonekh commented 1 year ago

Hi, I can run your code on ESP32 successfully. But I want to use this library with Attiny84 to build low cost LORA sensor. Is it hard to do? I have little knowledge on this low level programming. As far as I know, attiny84 required tinySPI or softSPI.

I try to compile your code on Attiny84. its size is too big

Sketch uses 7066 bytes (86%) of program storage space. Maximum is 8192 bytes.
Global variables use 692 bytes (135%) of dynamic memory, leaving -180 bytes for local variables. Maximum is 512 bytes.

Thanks;

nopnop2002 commented 1 year ago

ATTINY has too little RAM to migrate.

garudaonekh commented 1 year ago

Ok, it looks promising. After I removed all Serial.print from the your library, it's compiled successfully. Now, I have to figure out how to map the SPI pins.

Sketch uses 4610 bytes (56%) of program storage space. Maximum is 8192 bytes.
Global variables use 48 bytes (9%) of dynamic memory, leaving 464 bytes for local variables. Maximum is 512 bytes.
nopnop2002 commented 1 year ago

Good!!

These may be available. https://github.com/JChristensen/tinySPI https://github.com/nickgammon/bitBangedSPI


If it works correctly with ATTiny, please publish it on github. ATTiny+LoRa is very convenient.

garudaonekh commented 1 year ago

Actually, AttinyCore already include its own virtual SPI handling so I don't need to use tinySPI anymore, I simply use SPI library of Arduino. However, I can't get it to work on attiny84, after several tries my Attiny84 are gone, I am waiting for new ones. In the mean time, I try to make it work on Atmega328 first because it's easy to debug than attiny84 but I faced some issue, which I raise on another issue.

garudaonekh commented 1 year ago

Hi, I decided to use Atmega16 instead because Attiny84 is already double the price of Atmega16a. And I managed to make it works with atmega16a.

Thanks;