- Wed Jun 07, 2017 6:20 pm
Just got my hands on A20 chip itself and on a A20 breakoutboard (the one with DIP switches).
I took me a while to figure out how to flash it because documentation is rare - especially as most information is in Chinese.
Below you will find what you all are searching for.
I am able to flash as well the AI-Thinker A20 chip alone and also the breakout-board.
The A20 has an internal ESP8285 chip. The ESP8285 can communicate with the internal GSM part using AT commands. You need to establish a connection between serial pins of internal ESP8285 and the serial pins of the GSM part inflow want to control GSM login and SIM card within the chip itself.
You can also control the GSM part via AT commands directly from your computer, in my case a RaspberryPi.
Flashing A20's internal ESP8285:
This one can be programmed same way as the ESP8285 on Wemos D1 mini Lite.
So this is how you do it, I hope you guys program a lot so I can copy back
How to flash A20:
In arduino IDE select "generic ESP8285" as board
Baud rate 115200 worked, but not always, so I used 57600.
All dip switches off (in case you have the board and not the chip alone)
Small hint I f you have the A20board: the data pins on the boards USB connector are NOT connected, the USB port is for power only. You need an extra USB/Serial adapter (less than 1$ on Ali express) or any other serial port like on RaspberryPi.
Connections you have to make for flashing the A20:
Wf_RXd to USB/serial adapter RX
Wf_TXd to USB/serial adapter TX
Wf_io0 = low
Wf_RST = high 5kOhm to 3.3V - do not connect it to USB/serial adapter's RST pin if it has one!
Wf_io15 = low
Wf_io2 = high 5kOhm to 3.3V
Power on incl 5V (and 3.3V) - e.g. use 5V and 3.3V from external USB/serial adapter CH340.
When flashing is complete, switch Wfio0 to 3.3V high and remove WfRST from high and let it open (last step might be optional but seems to be necessary some times I tried)
What about the DIP switches on the board?
A20 GPS GSM Board (breakoutboard) with dip switches:
Dip switches: 2,4 ON: Wfio13 and Wfio15 of A20's internal ESP8285 are connected to the Serial Pins of GPRS part of the A20 Chip to control it with AT commands:
Wfio 13 --> UART_TXD
Wfio15 --> UART_RXD
(This is what you want to enable to control GSM from internal ESP8285)
BE CAREFUL: this means that you use GPIO13 and GPIO15 of ESP8285 for serial communication, you have to do Serial.swap(); in setup section of your sketch to use the other hardware serial.
Here comes something I dit not figure out yet: ESP8285 should have three hardware serials: Wf_RXD,Wf_TXD and Wf_io13, and as a third hardware serial port Wf_io15 as TX only.
But I was only able to get running the following:
This results in a serial RX/TX connection to A20 chip to control it with AT commands on Wf_io13 and Wf_io15 (when DIP switches 2 and 4 are ON) and in a serial output on Wf_io04 (TX only). I did not manage to get both bidirectional hardware serials to work at the same time. Maybe Serial0.begin(115200); works? Because it didn't accept Serial2.begin(115200); in my case.
Also I did not get software serial working on A20, the compiler simply doesn't accept that library for "generic ESP8285". I guess hardware.txt needs to be adapted.
DIP Switches 5 and 6 control whether the GPIO13 and GPIO15 of the ESP8285 are also connected to the pins on the breakoutboard.
GPIO13->Pin "Wfio13" on breakoutboard
GPIO15-> Pin "Wfio15" on breakoutboard
DIP switches 1 and 3 control whether the GPRS serial pins of A20 chip (UART_TXD and UART_RXD on the chip itself) are also connected to the corresponding pins on the breakoutboard (named H_TXD and H_RXD)
In Short: you can switch on all for testing after you have programmed internal ESP8285.
If you want ESP8285 to have NO(!!) onboard contact to GPRS part switch OFF DIP switch 2 and 4.
If you only want ESP8285 to control GPRS part of A20 chip with AT commands by internal ESP8285 but you don't need access to the pins for extra monitoring then you only need to switch ON Dip switch 2 and 4 and leave the others OFF.
If you want to use Wfio13 and Wfio15 of the ESP8285 (for other purpose use of GPIO13 and GPIO15) switch ON Dip switch 5 and 6 so that the pins Wfio13 and Wfio15 on the breakoutboard are connected to ESP8285, and leave OFF Dip switches 2 and 4.
If you want to control GPRS part of the A20 from external source, you need to switch OFF dip switches 2 and 4 and switch ON Dip switches 1 and 3 so that UART_RXD and UART_TXD are connected to the pins U_RXD and U_TXD on the breakoutboard but NOT to ESP8285. At the same time you may also switch ON Dip switches 5 and 6 to use Wfio13 and Wfio15 of ESP8285 for other purposes.