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

Modem.connect(apn='') issue #9

Open
Martijn21c opened this issue Feb 13, 2021 · 4 comments
Open

Modem.connect(apn='') issue #9

Martijn21c opened this issue Feb 13, 2021 · 4 comments

Comments

@Martijn21c
Copy link

Hi,

When I try this code the error popping up on the step modem.connect(apn='iew.be')
Traceback (most recent call last):
File "", line 16, in
File "SIM800L.py", line 293, in connect
File "SIM800L.py", line 276, in get_ip_addr
File "SIM800L.py", line 183, in execute_at_command
GenericATError: Got generic AT error

I use a LILYGO ESP32 with SIM800L.

@sarusso
Copy link
Collaborator

sarusso commented Feb 27, 2021

Hi @Martijn21c ,

the problem with generic AT errors is that they are.. well, generic errors :) Usually, the modem does not provide much more information in these cases, and debugging is hard.

However, you can try running with the logger on and set to the DEBUG level in order to get some more context.

@varna9000
Copy link
Contributor

If your APN uses username and password, the module won't connect with the current code. I modified sim800L.py and added the following

'setuser':     {'string':'AT+SAPBR=3,1,"USER","{}"'.format(data), 'timeout':3, 'end': 'OK'},
'setpwd':     {'string':'AT+SAPBR=3,1,"PWD","{}"'.format(data), 'timeout':3, 'end': 'OK'},                    

then add username and pass parameters to the connect() function

def connect(self, apn, user, pwd)

and call the two AT commands above, right after set APN command

self.execute_at_command('setapn', apn)
self.execute_at_command('setuser', user)
self.execute_at_command('setpwd', pwd)

In the actual code you can call the connect function as follows

    modem.connect(apn='yourAPN,',user='xxxx',pwd='xxxxxx')

After the above changes, my module connects ok.

@sarusso
Copy link
Collaborator

sarusso commented Apr 27, 2021

Thanks for the feedback @varna9000! Why don't you create a pull request with these few lines of code to get the credit you deserve for adding this functionality?

@varna9000
Copy link
Contributor

@sarusso Thanks, will do.

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

3 participants