-
Notifications
You must be signed in to change notification settings - Fork 82
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
config settings for ESP and ublox cellular communication #33
Comments
Hi again, and thanks for raising this as a separate issue. There are a number of things you need to be concerned with in the cellular section of u_cfg_app_platform_specific.h. I will go through them one by one. U_CFG_APP_CELL_UART: this is not a pin, it identifies the UART HW block inside your MCU which U_CFG_APP_PIN_CELL_ENABLE_POWER: if you have a relay or some such gating power to the cellular module then you need to set this to the MCU pin which controls that relay. If you don't you should set this to -1. U_CFG_APP_PIN_CELL_PWR_ON: the cellular module has a pin named U_CFG_APP_PIN_CELL_VINT: the cellular module has an output pin, named U_CFG_APP_PIN_CELL_TXD and U_CFG_APP_PIN_CELL_RXD: these I think you have understood. U_CFG_APP_PIN_CELL_CTS and U_CFG_APP_PIN_CELL_RTS: from what you have said above you have not connected the UART flow control lines between the MCU and your cellular module, in which case please make sure to set both of these values to -1 or no UART communication will succeed. If you need to set the APN, i.e. your SIM card/provider requires you to use a specific APN and not just accept the network default, then, for the sockets example, you need to look at the config structure. You will see that there is a comment against one of the fields |
Thanks, Rob, Yes, I was suspicious U_CFG_APP_CELL_UART 1 has a more important role being at the top of the code, that is why I set it to 1 previously, but thanks for the clarification about it and other pins, I knew some of them reading the Sara-r4 datasheet and I had set most of the pins as you mentioned. As you mentioned ESP32 has several uarts(3 I guess), Since I am using feather board(esp wroom-32) and one of its available uart pins; gpio 16 and 17 are u2rxd and u2txd, so is it uart hardware block 2? then should I set U_CFG_APP_CELL_UART to be 2? APN in my case is hologram, so I will modify NULL in NULL, /* APN: NULL to accept default Thanks, |
The ESP32 is capable of using any pins with any HW UART block so it's really up to you; you could leave it at 1 or try changing it to 2, it shouldn't matter. On the APN it is the same field you modify, you just put in it whatever string your SIM/service provider tells you to. I doubt that AT&T needs a specific APN though, the AT&T network should provide the necessary APN to the module at network registration and you should be able to leave the APN for that case at the default of |
Hi Rob, Thank you for your precious feedbacks, I was able to upload the sockets.ino to ESP board; in the terminal after showing a few lines of AT, it says the cellular network does not connect, and the on Sparkfun Sara R4 breakout board that I power with a Lipo does not turn blue, I loaded code on Adafruit ESP feather also ESP dev board, same results... Config setting; I directly manipulate u_cfg_app_platform_specific.h in Arduino libraries>src folder as follows; First Everything on u-cfg-short-range I set to -1 in Arduino code, I left "simpin" and APN to NULL, I am using these pins on Sara-R4 breakout boards; In this video, Jim explains at minute 1:01 you can use it directly with uart; Also you can find it in "UART interface" title here; https://learn.sparkfun.com/tutorials/lte-cat-m1nb-iot-shield-hookup-guide/all#hardware-overview So the uart serial shown in the video has 6 pins, 2 NC, TX(I connected to Esp gpio17), RX(esp gpio17), Ioref(I connected to 3.3V on esp32 that will convert esp uart to 1.8 volts for sarar4 if you look at their schematic), and Gnd(I connected to feather esp grnd), my question is
Thanks, |
You say "in the terminal after showing a few lines of AT": would you be able to post what you see here, just so that I can understand what is happening better? What you have set in On the pins etc, can you confirm that you have pin 17 of your MCU connected to the I'm not a HW engineer (despite having a degree in it, from many years ago) but I very much doubt that any pull-up or pull-down resistors are required on the You should not need to make any changes in the On the US network thing, the network registration timeout is set in that same |
Hi Rob, How is it going? Yes, RTS and DTR are connected to GND in Sparkfun shield, I did a continuity check to board's GND with Voltmeter. The Arduino Terminal report; U_CELL_PWR: powering on. My board is an Adafruit ESP feature board, so I connect feather board gpio 16 which is RX2 to Sara R4 RXD pin, and its gpio 17 which is TX2 to Sara R4 TXD pin. So I guess 16 means gpio 16 and 17 gpio17, as I changed them to their esp32 pin 27 and 28 (ESP wroom pin numbers), got an uart error in the terminal, so I brought it back to 16 and 17 as seen above. I swap the rx tx cables, it will have the same terminal report; Network is not available! To be able to make the Sparkfun LTE modem working when I was connecting it to Arduino uno Redboard, setting MNO_ATT was important as follows; To do the same thing In the ublox arduino code for feather board, in config part I set; OR I set it as I set both to NULL, it does not work, unfortunately. I wanted to see which pins you connect to rx and tx in devkit c; These are U_CFG_TEST pins (which I did not touch test pin configs) not U_CFG_APP pins, also in your ESP32; Also in u_cfg_app_platform_specific.h You connect tx and rx as follows; Thanks, |
The problem we have here, MCU UART apparently transmitting commands to the module but getting no response at all from the module, is likely due to one of the following reasons:
I've checked the integration manual for SARA-R4 and on page 20 it says: "Once a valid VCC supply is applied to the SARA-R4 series modules, they remain switched off in the power-off mode. Then the proper toggling of the So the SARA-R4 series modules will NOT power on without a pin from the MCU being connected to the Concerning the UART pins we use on ESP32 devkit C, it doesn't matter which lines are chosen: the UART HW inside the ESP32 chip can be muxed to any IO line on the chip (with a small number of exceptions); Espressif happened to label some pins of their IO connector as the UART pins but there is nothing special about those pins, they are just 3.3V digital inputs or outputs. You can ignore the |
Thanks Rob, you're right, in sparkfun shield schematic also they connect the power-on and reset pins to the module, so I connected gpio 14 as power-on pin to Sparkfun shield D5 pin which toggles the power-On pin, I see the shield blue LED blinking as AT commands are sent to the board; U_CELL: initialising with enable power pin not connected, PWR_ON pin 14 (0x0e) (and is toggled from 1 to 0) and VInt pin not connected. So I think we are one step closer to make it work! Does your code connect for a while and disconnects? Also I will strat designing our own Eagle sara-r4 breakout board with accessing more pins! Since this Sparkfun shield is designed mainly for Arduino Uno... Btw, To set the mobile network operator, MNO, in Sparkfun library it is set is as follows; In ublox, in some modules, they use +UMNOPROF, not sure it is supported by Sara-r4. Regards, |
Progress, excellent. I would guess that the Hologram website showing a connection means that they have some form of back-door connection into the cellular operator and that the cellular module has powered up and registered with the network (which it will do automagically when a SIM is inserted). This is a good step forward, we have a Did you check the IO voltages: remember that your MCU will be 3.3V logic, the module is 1.8V logic so without a level shifter somewhere the serial port will not work and the module may be damaged by over-voltage. Setting the MNO profile is supported by But none of that is going to do anything until the UART issue is resolved of course. EDIT: just checked the image you posted in the other thread and there appears to be no level shifter in the UART lines between the MCU and the Sparkfun board so, unless there is one hiding on the Sparkfun board, this is definitely your issue; you need a bi-directional level shifter, e.g. one of these with the low-voltage supply for it connected to the |
Thanks, Rob, yes Sparkfun lte shield has a level shifter, mentioned in the left part of page 1 of their schematic; So when I connect UART from ESP feather it goes to Sparkfun level shifter first, converting 3.3 V to 1.8V. Meanwhile, if you got time, you can take a look at these popular examples of the Sparkfun shield and see if anything in them is useful being part of your codes; Thanks for helping with the MNO code too. Regards, |
Hmm, that's all fine then. One more thing to check: do make sure that the cellular module does NOT detect that the USB interface is connected to it; if it does it will ignore anything on the UART port. In other words JP6 must be open (and, while we're at it, JP4 and JP5 must be closed). After that I'm out of ideas, I can't see any reason why the UART comms between the MCU and the cellular module never work. Time to get your Salaea probe or whatever out and monitor those UART lines. |
Thanks Rob! Yes, Sparkfun LTE board has many connection scenarios (Uart, Uno, USB). Yesterday, I designed a prototype for a SaraR4 breakout board to communicate with ESP directly(not using the Sparkfun shield), it has more direct pins from ESP to the breakout board; power-on, etc. This experience, Arduino-based ublox library, and your recommendations gave me the confidence to design the board, I will report how it works when ready! Thanks, |
Hi Rob,
So recently, I was able to upload runner to Adafruit ESP32 feather board successfully;
https://github.com/u-blox/ubxlib/tree/master/port/platform/esp-idf/mcu/esp32/runner
And I connected its GPIO16 and GPIO17 as RX and TX to Sarar4 breakout board(Sparkfun shield);
https://learn.sparkfun.com/tutorials/lte-cat-m1nb-iot-shield-hookup-guide/all
I get the following error when running ExampleSockets(first choice);
idf.py -p COM5 -D TEST_COMPONENTS="ubxlib_runner" flash monitor
Running ExampleSocket... by clicking "1"
Added network with handle -5
Bringing up the network...
Unable to bring up network!
Done.
I modified the server part in example >sockets> main.c to the following;
// Echo server URL and port number
#define MY_SERVER_NAME "www.google.com"
#define MY_SERVER_PORT 80
Also, how can I register operator and APN in this example?
Here is how I was able to set APN and operator in Sparkfun;
https://github.com/sparkfun/SparkFun_LTE_Shield_Arduino_Library/blob/master/examples/00_Register_Operator/00_Register_Operator.ino
Details:
Btw, I tested Sparkfun and hologram Simcard; Hardware works, and I was able to run their Arduino codes, like sending SMS or registering AT&T network...; These are easy Arduino examples you might like to include in your Arduino Platform...;
https://github.com/sparkfun/SparkFun_LTE_Shield_Arduino_Library/tree/master/examples
Then I disconnected the Arduino board from Sparkfun lte shield and connected 4 pins RX,TX,VCC, and ground from ESP32 feather to the late shield and I run the runner in IDF, which did not work as I explained.
My u_cfg_app_platform_specific.h configuration in folder ...ubxlib\port\platform\esp-idf\mcu\esp32\cfg:
what I did is just connect rx and tx as gpio 16 and 17 from ESP feather board uart2 to sparkfun lte shield;
define U_CFG_APP_PIN_CELL_TXD 17
define U_CFG_APP_PIN_CELL_RXD 16
Also, it looks like below, I set "cell uart" to 1, but I guess I should set it to -1 like other pins, too? not sure what it does...
define U_CFG_APP_CELL_UART 1
Thanks,
MoZen
The text was updated successfully, but these errors were encountered: