-
Notifications
You must be signed in to change notification settings - Fork 77
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
Increasing transmission rate of Ebyte E34 2G4D20D #65
Comments
@KrisKasprzak Any info on this would be much appreciated, I would like to have your opinion on this before moving forward |
If you increase the USB baud rate and air data rate, you will get faster data rates. I'm not sure how much data you want to transmit. More importantly, I'm not sure over what distance--that too will make a difference in how fast you want to move data. The air data rate I believe can run up to 57.6 which will help. I hate to say it but the only suggestion I have is to get a few units and test it out. |
Thank for the response Kris, will try that out. |
As you probably found the argument for CompleteTask is a timeout to prevent an infinite loop. The time for aux pin to return high should be 2 ms according to the datasheet. Depending on the MCU, this can take longer. My experience is using a Cortex processor (Teensy MCU), time to see aux pin go high is < 10 ms. I have a provision for projects that run out of pins, users can omit the aux pin and hope it goes high in 1 sec (see line 224 in the .cpp file). not sure this helps, but keep us posted. |
Ok Kris! we will work on this and update you on how it turns out. Thanks Kris! |
Hello @KrisKasprzak, I implemented fix. however, transmission rate spikes up and after a moment, returns to transmitting per second again.... any way we can make the fast transmission consistent. |
``Hello Kris, thanks for the ebyte library provided and the video intro provided at https://www.youtube.com/watch?v=hMjArKGucFA
So I decided to modify the library, specifically, increasing the transmission rate per second a bit to suit my needs. At first, I observed that t when I call the SendStruct(const void *TheStructure, uint16_t size_) in loop() method, it defaults to 1 transmission per second and I wanted it faster, lets say up to 12 transmisson per second. I didn't know how to go about it so I studied the Ebyte.cpp library and adjusted the line of code below:
Please Note: I specifically reduced CompleteTask time from CompleteTask(1000) to CompleteTask(100):
`bool EBYTE::GetStruct(const void *TheStructure, uint16_t size_) {
}`
`bool EBYTE::SendStruct(const void *TheStructure, uint16_t size_) {
}`
`void EBYTE::CompleteTask(unsigned long timeout) {
}`
I observed that transmission rate increased, so I uploaded same code on a second device, but observed that I wasn't receiving what was transmitted from Tx on Rx.
Below is the sample source code I am using for Tx and Rx:
`#include "EBYTE.h"
#define PIN_RX 16 // Serial2 RX (connect this to the EBYTE Tx pin)
#define PIN_TX 17 // Serial2 TX pin (connect this to the EBYTE Rx pin)
#define PIN_M0 4 // D4 on the board (possibly pin 24)
#define PIN_M1 22 // D2 on the board (possibly called pin 22)
#define PIN_AX 21 // D15 on the board (possibly called pin 21)
// i recommend putting this code in a .h file and including it
// from both the receiver and sender modules
struct DATA {
unsigned long Count;
int Bits;
float Volts;
float Amps;
};
// these are just dummy variables, replace with your own
int Chan;
DATA MyData;
DATA MyDataTx;
unsigned long Last;
// create the transceiver object, passing in the serial and pins
EBYTE Transceiver(&Serial2, PIN_M0, PIN_M1, PIN_AX);
TaskHandle_t Task1;
// LED pins
int counter1 = 0;
int counter2 = 0;
void setup() {
Serial.begin(9600);
Serial2.begin(9600);
Serial.println("Starting Reader");
// this init will set the pinModes for you
Serial.println(Transceiver.init());
// all these calls are optional but shown to give examples of what you can do
Serial.print("Data rate: ");
Serial.println(Transceiver.GetAirDataRate());
Serial.print("Channel: ");
Serial.println(Transceiver.GetChannel());
Serial.print("Baud rate: ");
Serial.println(Transceiver.GetUARTBaudRate());
Serial.print("Transmission mode: ");
Serial.println(Transceiver.GetTransmissionMode());
// and address is the same
Transceiver.PrintParameters();
//create a task that will be executed in the Task1code() function, with priority 1 and executed on core 0
xTaskCreatePinnedToCore(
Task1code, /* Task function. /
"Task1", / name of task. /
80000, / Stack size of task /
NULL, / parameter of the task /
tskIDLE_PRIORITY, / priority of the task /
&Task1, / Task handle to keep track of created task /
0); / pin task to core 0 */
delay(500);
}
void loop() {
// Main core used for sending
Serial.print("Tx Task running on main core ");
MyDataTx.Count=333;
MyDataTx.Bits = analogRead(A0);
MyDataTx.Volts = 9.99;
// vTaskDelay(10/portTICK_PERIOD_MS);
}
//Task1code:Receiver task
void Task1code( void * pvParameters ){
Serial.print("Task1 running on core ");
Serial.println(xPortGetCoreID());
for(;;){
}
}`
My goal is to increase transmission rate from one transmission per second to 12 or more transmission per second.
Any push in the right direction will be much appreciated.
Thanks
The text was updated successfully, but these errors were encountered: