Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ATTinyCore and RFM69 issue / help #808

Open
SpenceKonde opened this issue Sep 24, 2023 Discussed in #807 · 1 comment
Open

ATTinyCore and RFM69 issue / help #808

SpenceKonde opened this issue Sep 24, 2023 Discussed in #807 · 1 comment

Comments

@SpenceKonde
Copy link
Owner

Discussed in #807

Originally posted by stevensarns September 15, 2023
Hello & thanks in advance for any help. I am having a problem using the RFM69HCW module attached to a ATtiny841. I think the problem is with the SPI library/ATTinyCore. I have successfully used the same code with ATmega328PB and ESP8266 processors. I have narrowed the code down as much as possible to illustrate the issue.
When all code using SPI transfers is commented out, the code works as expected as evidenced by the action on the "scope" pin. However as soon as any SPI action is called, the code hangs; no action on the scope pin and no action on any SPI pin.
I am using ATTinyCore/Konde v1.4.1 and RFM_LowPowerLab v1.5.2 Arduino IDE 1.8.13. The RFM69 module is connected to PA4 to PA6 (SCK, MISO, MOSI, NSS) but not connected for this test (same results if connected).

`
// ATtiny841, chip 841, clock 8MHz internal<4.5V, bootloader UART0
// with optiboot - 71% flash, 66% RAM, requires millis()
// use print(F("xx")) 72% flash, 58% RAM

#include <RFM69.h>
#include <SPI.h>

#define NETWORKID 0 // Must be the same for all nodes
#define MYNODEID 22 // My node ID
#define TONODEID 99 // Destination node ID
#define FREQUENCY RF69_915MHZ // RFM69 frequency
#define scopePin PIN_PB0 // debug

RFM69 radio; // Create a library object

// ----------------------- Setup -------------------------------
void setup() {
Serial.begin(9600); // 115200 works also
pinMode(scopePin, OUTPUT);
delay(200);
Serial.println("Start");
radio.initialize(FREQUENCY, MYNODEID, NETWORKID); // Initialize the RFM69HCW:
// radio.setHighPower(); // Always for RFM69HCW
Serial.println("ok");
}

// ------------------------ Main ----------------------------
void loop() {
scope();
if (radio.receiveDone()) { // incoming msg complete
Serial.print(F("received from ")); // print out the data received
Serial.print(radio.SENDERID, DEC); // from ID
Serial.print(F(", msg [")); // DATA array, DATALEN bytes in size:
for (byte i = 0; i < radio.DATALEN; i++) Serial.print((char)radio.DATA[i]);
Serial.print("], RSSI "); // RSSI smaller stronger
Serial.println(radio.RSSI);
}
}

void scope() {
delay(1);
digitalWrite(scopePin, HIGH);
delay(1);
digitalWrite(scopePin, LOW);
}`

@SpenceKonde
Copy link
Owner Author

a hang with no action on the SPI pins when we start doing SPI stuff is not good, And the same code is known working elsewhere? (a hang with action on the SPI pins would be less clearcut)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant