-
Notifications
You must be signed in to change notification settings - Fork 58
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
HardwareSerial and ESP32 #43
Comments
Hi, Antonio, If I change It fails to compile: Do I have to do anything on my sketch?
|
Have you included Show me the error please |
Hi, I did include it now. When I compile the sketch it returns: Sim800.h is as below with all changes you asked for:
|
Antonio, this is the compiler's log.
|
Hi Antonio, I have never dealt with the internals of libraries but I am trying to figure out what may be wrong and I believe it is still something to do with the Serial port. The compiler messages: error: invalid conversion from 'const char*' to 'const uint8_t* {aka const unsigned char*}' [-fpermissive] Indicate the change to HardwareSerial may require more adjustments. The FTP functionality will be added to a main sketch that already uses HardwareSerial for the SIM800 to post data to a SQL database so I understand it is desirable to keep HardwareSerial. I will keep trying to understand what might be wrong but your help will be highly appreciated once I am not experienced enough to get this thing working by myself in any short time frame. Thanks |
Hi, I've created this branch trying to fix your problems (sorry I don't have the same hardware) https://github.com/carrascoacd/ArduinoSIM800L/tree/add-compatibility-for-esp32 Download it and let me know if it works now, or we can iterate with the next problem |
Antonio, good morning. What I did was to delete the folder holding the previous library and used sketch/include library/add .zip library.
|
Hi, please download it again from the same branch https://github.com/carrascoacd/ArduinoSIM800L/tree/add-compatibility-for-esp32, I fixed the compilation errors. |
Hi Antonio.
Sketch code as below:
I tried to put some probes at ftp.cpp but it did not print. See fragment below:
|
It should be retrying to connect. Please, ensure you can see in your serial monitor the output from this line we need to see what is going on. Try also this function |
Hi, thanks. The hardware and the SIM card are OK, I do have a test sketch to test the size of a file on my FTP server using AT only commands and it is working (see code and console display below). The main sketch remains the same.
Console output:
The Test Sketch I am using to verify if GPRS is connecting is as below:
Console output for this test sketch:
|
Antonio, I have been looking into the code and try to understand things I am not familiarized with and I believe the problem is still related with the proper connection between the code and the serial port. The sketch I am using and I have published above is just a test platform to later move the concept to the main project that is much larger. I tried to unify this main project with the test code I posted above but did not succeed. The fact is that in my project's sketch the GPRS connection is established and used by first defining as follow: Then latter this SerialAT is used in all GPRS related operations. In your suggested implementation you recently changed SIM800.cpp to make this "connection" using: Is it possible to use the style I am using currently: SerialAT as above stated before setup(){}? Also, the following initialization is already present in the original setup() and used elsewhere:
Is it possible to just use this one? Thanks |
Hi Antonio, I had some time to try it again today and went back to your suggestion to use serialDebug();
The result is that it echoes every command I type on the Arduino serial terminal:
Regards |
If the serial debug is working it means that the connection with the
changes you made to use HardwareSeral are properly working.
I ordered an ESP32 board to debug it. You need to see output when DEBUG is
enabled, otherwise I can't help you right now. Try to check why is not
showing anthing before.
…On Fri 22 May 2020, 6:13 p.m. Paulo Borges ***@***.***> wrote:
Hi Antonio, I had some time to try it again today and went back to your
suggestion to use serialDebug();
I tried it inside my sketch but it did not work then I made the following
change at SIM800.cpp (please see fragment below):
void SIM800::sendCmd(const char *cmd, unsigned int delayBeforeSend)
{
Serial.println("Starting Manual Serial...");
serialDebug();
//serialSIM800.listen();
serialSIM800.flush();
delay(delayBeforeSend);
write(cmd);
serialSIM800.flush();
}
The result is that it echoes every command I type on the Arduino serial
terminal:
Fat FS: Mount OK
Loop starting....
File mount OK.
Modem init OK
Starting Manual Serial...
AT
AT
at
AT+CREG?
Regards
Paulo
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBWFOFKOPVMBB7ECGDBSB3RS2QCJANCNFSM4NBTDT6Q>
.
|
Hi Antonio, I have the following test sketch and it is similar to this manual serial control you suggested. The following one works: If you can take a look in this code that works and propose some change based on that I will try my best to make experiments and try to fix it. Thanks
|
Antonio, good afternoon, When I run my test sketch above that sends console commands from the serial console straight to the modem's serial port (Serial1 in the above test) it returns OK from the modem, except for the command: When I use the serialDebug(void) from your library instead of returning OK it returns precisely what I type, whatever I type and only what I type. Please see below:
My conclusion is that the Modem Serial port is, somehow, "wired" to the console Serial port. I have tried to modify Sim800.h on the following part:
So, my feeling is that What do you think? Thanks |
The serial debug mode is intended to read the input from the PC Serial (your serial monitor) and then read the output from your ESP module to print it. What is happening is that you see what you type, it is normal. The problem is that ESP is not responding to your manual commands. AT input should respond OK. You are having a connection problem, try to figure out why. |
Hi, Correct but the serial debug function on Sim800.cpp has no provision to print on the console the command I just typed on the console. The Sim800.cpp only has provision to print whatever comes from the serial port where Sim800 GSM modem is connected (Serial.write(serialSIM800.read());) Also, I understand that the response OK comes from the modem right? Thanks |
@pcbtborges Did you manage to solve the problem? |
Hi, the transfer works sometimes, the larger the file the more often it fails. |
@pcbtborges #define csSD 5 bool debug = 1; void setup() { //init SD Card //check if file arivle //GPRS part void loop() { } byte initSim900() { byte initSim900FTP() { byte Sim900FTPSend (){ XcomB.concat("+FTPPUT:2,"); char XxcomA[XcomA.length()]; XcomA.toCharArray(XxcomA,XcomA.length()); if (dataFile) {
} unsigned char sendATcommand(char* ATcommand, char* expected_answer1, unsigned int timeout) { byte powerUp_Sim900() { byte powerDown_Sim900() { void powerSim900() { char* string2char(String command){ byte checkFile() { |
I am a bit busy with other things right now but will sure try this one a soon as I do have some spare time. |
Following this #40 (comment)
The text was updated successfully, but these errors were encountered: