Replies: 10 comments 32 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Seems like I had a typo earlier, got it fixed. radio.transmitDirect();
delay(10);
uint16_t rawTimings[] = {400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12000, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400};
for (int i = 0; i < sizeof(rawTimings) / sizeof(rawTimings[0]); i++)
{
digitalWrite(20, (i % 2 == 0) ? HIGH : LOW);
delayMicroseconds(rawTimings[i]);
}
digitalWrite(20, LOW); |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Sorry to jump in to this old conversation, but you all are talking about things I am attempting to research without much luck. I want to use synchronous serial to rx data. Per Ti Developer note AN095 sync serial provides the clock on one pin and the data on another. What I can't find in either LSatan's ELECHOUSE lib or in Radiolib is how this is set up in the api's. Which pin is which? Also for that matter I see in radiolib directmode which I assume is synchronous serial, as I see directmode async. |
Beta Was this translation helpful? Give feedback.
-
I made a simple RF remote repeater with LSatan's ELECHOUSE lib but I've yet to published it. Mine works by polling gdo2 pin when its in direct receive mode, it then stores the duration of it's HIGHs and LOWs into an array. As for replaying the signal it does it in direct mode as well. These examples may be of interest Rc-switch example . |
Beta Was this translation helpful? Give feedback.
-
Came back to this because of your transmitdirect discussion above. I got serial sync rx working but need sync tx ha. Seems like I always end up circling back to where I started. Although your discussion also clued me in because when using the FIFO for tx I hadn't disabled CRC or set fixed packet length. Need to do more experiments, because I am good with FIFO limitations if the end result is exactly what I put in. |
Beta Was this translation helpful? Give feedback.
-
The maintainer pushed a fix, but didn't issue a new release as of yet.
Should be easy enough to include the changes in your local library.
Alternatively you could simply delete your local Physical layer cpp and
replace it with the current one from the repo.
As for my implementation, no I haven't done it yet because I am thinking of
a better way o purge the buffer if RSSI is less than the set point.
With direct read, we are constantly reading the pin if the clock is high
and storing it in the buffer even if it doesn't meet your specified RSSI.
Sure we could use an else and read out each byte to do nothing with if RSSI
is too low but that is pretty wasteful. We could also use memset/memcpy
with God mode to zero out the buffer directly (and reset the bufferWritepos/bufferReadpos,) but the current buffer
implementation is writing directly to the bytes in the buffer which gives
me pause.
So I'm still thinking a bit.
…On Mon, Apr 29, 2024, 11:04 AM smolbun ***@***.***> wrote:
I tried rewriting the code that gets bytes that is under -50 rssi,
getRSSI() is stuck at -74. You've raised an issue that was marked as
completed, do you have an implementation of that?
void loop() {
while (radio.available() && radio.getRSSI() >= -50) {
byte b = radio.read();
Serial.print(b, HEX);
}
}
—
Reply to this email directly, view it on GitHub
<#842 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AULD4G5RGKAW2FNCZM7RCBTY7ZORRAVCNFSM6AAAAAA5ULDH22VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TENRUGEYDI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Took a much closer look, and based on a convo I had with the maintainer I think I have an idea so updateDirect isn't writing straight to the buffer, and instead writing to an intermediate single byte buffer. That way we can pull the buffer out from the God Mode restriction and access it/modify it directly. I'll see if I can get something together and put in a pull request in the next few days. |
Beta Was this translation helpful? Give feedback.
-
Hi @jgromes , I'm quite confused on the behaviour of setBitRate(), I've set it to 3.33 and indeed each pulse is 300us. I'm transmitting in direct mode shouldn't the pulse follow accordingly? Is there a way to avoid such behaviour without having to explicitly set the bit rate to 2.5 to achieve 400us? #include <RadioLib.h>
#include <SPI.h>
#define SCK_PIN 10
#define MISO_PIN 8
#define MOSI_PIN 7
#define SS_PIN 4
#define gdo2 3
#define gdo0 1
CC1101 radio = new Module(SS_PIN, gdo0, RADIOLIB_NC, gdo2);
void setup() {
Serial.begin(115200);
delay(2000);
Serial.print(F("[CC1101] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("CC1101 Init: Success!"));
} else {
Serial.print(F("CC1101 Failed: Code "));
Serial.println(state);
while (true)
;
}
radio.setFrequency(433.92);
radio.setBitRate(3.33);
radio.setOutputPower(10);
radio.setOOK(true);
radio.setCrcFiltering(false);
radio.disableSyncWordFiltering();
pinMode(gdo0, OUTPUT);
}
void loop() {
radio.transmitDirect();
delay(10);
uint16_t rawTimings[] = { 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12203, 400, 1200, 334, 1273, 1148, 400, 1200, 457, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12188, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12207, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12190, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12194, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12206, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12193, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12210, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12198, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 12195, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 1200, 400, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 400, 1200, 1200, 400, 400 };
for (int i = 0; i < sizeof(rawTimings) / sizeof(rawTimings[0]); i++) {
digitalWrite(gdo0, (i % 2 == 0) ? HIGH : LOW);
delayMicroseconds(rawTimings[i]);
}
digitalWrite(gdo0, LOW);
radio.finishTransmit();
delay(5000);
} |
Beta Was this translation helpful? Give feedback.
-
Hi @jgromes I notice that with receiveDirectAsync(), getRssi() seems to only return -74 but with receiveDirect(), it works normally. I'm currently using v6.6 of the library, v6.5 does not have this issue. #include <RadioLib.h>
#define SS_PIN 4
#define gdo2 3
#define gdo0 1
#define usrbutton 21
CC1101 radio = new Module(SS_PIN, gdo0, RADIOLIB_NC, gdo2);
void setup() {
Serial.begin(115200);
while (!Serial) {};
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("CC1101 Init: Success!"));
} else {
Serial.print(F("CC1101 Failed: Code "));
Serial.println(state);
while (true)
;
}
pinMode(gdo0, INPUT_PULLUP);
pinMode(gdo2, INPUT_PULLUP);
pinMode(usrbutton, INPUT_PULLUP);
radio.setFrequency(433.92);
radio.setOOK(true);
radio.setRxBandwidth(650);
radio.receiveDirectAsync();
}
const int rssiThreshold = -55;
const uint16_t maxSample = 2000;
uint16_t timings[maxSample] = { 0 };
uint32_t lastTime = 0;
uint16_t sample = 0;
bool RSSIflag = false;
void loop() {
uint32_t time = micros();
if (RSSIflag == false) {
int rssi = radio.getRSSI();
Serial.println(rssi);
if (rssi > rssiThreshold) RSSIflag = true;
}
if (RSSIflag) {
static uint8_t prevLevel = 0;
bool level = digitalRead(gdo0);
// On state change
if (level != prevLevel) {
uint32_t duration = time - lastTime;
if (sample > maxSample) {
sample = 0;
memset(timings, 0, sizeof(timings));
}
if (!(sample == 0 && prevLevel == 1)) timings[sample++] = duration;
lastTime = time;
prevLevel = level;
}
RSSIflag = false;
}
static bool readyToReplay = false;
if (sample > 10 && time - lastTime >= 100000) {
Serial.printf("Samples: %d \n", sample);
uint16_t size = sizeof(timings) / sizeof(timings[0]);
Serial.println("Raw timings: ");
Serial.print("[");
for (uint16_t i = 0; i < size; i++) {
if (timings[i] != 0) {
Serial.print(timings[i]);
if ((i < size - 1) && (timings[i + 1] != 0)) {
Serial.print(", ");
}
}
}
Serial.println("]");
lastTime = time;
sample = 0;
readyToReplay = true;
}
if (readyToReplay && digitalRead(usrbutton) == LOW) {
Serial.println("Replaying Signal");
int size = sizeof(timings) / sizeof(timings[0]);
pinMode(gdo0, OUTPUT);
radio.transmitDirectAsync();
radio.setOutputPower(10);
for (uint16_t i = 0; i < size; i++) {
digitalWrite(gdo0, (i % 2 == 0) ? LOW : HIGH);
delayMicroseconds(timings[i]);
}
digitalWrite(gdo0, LOW);
pinMode(gdo0, INPUT_PULLUP);
radio.receiveDirectAsync();
memset(timings, 0, sizeof(timings));
readyToReplay = false;
delay(100);
}
} |
Beta Was this translation helpful? Give feedback.
-
I've been playing around with Universal Radio Hacker (URH) particularly ASK modulation.
I'm having issues replaying "88ee88ee8888888e8888888e8".
For 2 and 3 I'm referring to rc-switch specifically from LSatan's CC1101 Library
CC1101 module with RadioLib
Code for 1:
Beta Was this translation helpful? Give feedback.
All reactions