This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sending AT commands to a GSM

Hello All, I am working with a pre-programed PCB; the main components of the are a nRF51822 chip, a GPS, and a GSM. I am using a J-link to communicate to the entire board through the SWD (SWDIO and SWDCLK) pins on the nRF51. I need to send AT commands to the GSM to test it for functionality. How do I do that? I have been told that I need to embed the AT commands in the nRF51's source code and re-flash it to the chip. However, I do not have the original source code. Is there any way to have the nRF51 send the GSM the AT commands without re-flashing the the source code? I would like to send the AT commands using serial (using a Putty or the like). Can this be done through the SWD pins? Thanks.

  • Hi!

    I think the only possibility would be to use the debugger interface to manually write to the UART0 registers. You need to set up the PSELTXD/PSELRXD, BAUDRATE and CONFIG registers, set ENABLE to 0x04 and enable the STARTTX task first. Then you should be able to write single bytes by writing 0 to EVENTS_TXDRDY, write your byte to the TXD buffer, and poll the EVENTS_TXDRDY area periodically until it is 1 again. Assuming that the firmware is not using the UART peripheral already, reseting your settings.

    This is of course terribly hacky, quite slow, and keeps the debugger interface enabled (which will likely break ongoing radio activity and keep the power consumption very high). But if you need to seldomly send a few commands, this could do the trick.

  • @Aaron: if you have access to the SWD interface and if the firmware on the nRF51 chip is not read back protected. You can simply readout the chip's image, store it. Then make your own firmware to test the GSM chip. After you have done that you can flash the original image back.

    Or you can simply don't power the nRF51 chip, and hook the UART lines from PC to the UART pins on the GSM chip. And can try to control it from the PC. This would require some hardware hack on the board.

    Or you can try what Ulrich suggested.

  • Hello Ulrich. When you say to use the debugger interface do you mean the J-Link RTT Viewer or the debugger in Keil? If you do mean Keil, how can the debugger be accessed without the source project. Thanks.

  • You can access the debug interface through e.g. the JLink DLL using nrfjprog. The nrfjprog executable has --memwr and --memrd that can be used for this. It can also download the current application if you want to have a copy of it (and if readback protection is not enabled).

Related