UART – Writing and Reading AT Commands

at commandsstm32uart

I am working with a B-L072Z-LRWAN1 board and a 8pya00-simcom-evb v1.02 board with SIM7000E. This SIM module operates through AT commands and I need to send these commands through an UART connected between mentioned boards.

I have already set up the UART in the B-L072Z-LRWAN1 and I am able to transmit bytes of information, but I am not sure how to send AT commands.

Which is the format I have to use to send the commands? Do I use char variables? Do I use uint8_t variables and add '0' at the end to make them chars? Do I need to add \n\r at the end of the command?

I am a little bit confused so I need your help.
Thank you!

Best Answer

char and uint8_t should be equivalent on ARM, in other words, char should be unsigned, but there are toolchains out there with char by default signed. It does not matter in this case anyway, because AT commands would only use characters in the [0-127] range.

Adding a \r at the end of the command is mandatory, \n and \x00 would probably be ignored, but better not send them. Responses are terminated with \r\n (not \n\r)