Sending AT commands over UART - c

My problem is sending AT commands over UART. I am working with STM32 IDE. I have the hardware: STM32L476 with a sensor shield together with the ESP01 Wifi module.
I got the hardware to work and can already send the first AT command over Uart to ESP01. When I try other commands AT+RST or AT+GMR I don't get any response back.
I use this code to send over UART to ESP01.
void ATsend (char out[]){
HAL_UART_Transmit(&huart4, (uint8_t *)out, strlen(out), 1000);
}
The code below works fine
ATsend("AT");
I get the response OK.
When I try this I get no response.
ATsend("AT+RST")
Any tips?

If you are sure that your UART receiver, or your DCE in RS-232 notation, supports the commands you're sending, this guide might be helpful:
https://docs.espressif.com/projects/esp-at/en/latest/esp32/faq.html#when-the-host-mcu-sends-an-at-command-to-the-esp32-device-there-is-no-response-what-is-the-reason.
The guide indicates as a possible solution also for the ESP8266 products the following: <<When the host MCU sends an AT command to the ESP32 device, there is no response. What is the reason?
A terminator (“ATrn”) must be added after an AT command when the host MCU sending AT commands to an ESP32 device. Please see Check Whether AT Works.>>
There's also this link: https://docs.espressif.com/projects/esp-at/en/latest/esp32/Get_Started/Downloading_guide.html#check-whether-at-works.
I hope these suggestions can solve your problem. At least they can indicate to you if the device is working.
There might be other causes of malfunction, but in this case I need more information to help you solve them and I suggest that you write to my company for professional support.
Yours sincerely,
V.D.

Related

Problem while uploading code in arduino atmega2560

I have arduino atmega2560 when i upload blink code than it shows error
avrdude: stk500v2_ReceiveMessage(): timeout.
I have checked the COM port is correct also that the driver is correctly installed.
Why would I be receiving a timeout error?
The possible reasons:
Faulty communication cable
Wrong com port selected
Wrong device model selected
Baud rate settings
Driver related issues
I think your arduino got bricked. But first try to reconnect it and upload your program.
Second try to disconnect any rx or tx pin connected. Third if your arduino is bricked, try to check this article for full solution of bricked arduino. Programmer is not responding arduino

STM32 USB CDC did not work

I'm using stm32l151 and I want to use usb peripheral in cdc mode. I used stm32 cubeMx to generate the project. however the function CDC_Transmit_FS() always return USBD_BUSY. can anyone help me?
Here is my code:
while (1)
{
CDC_Transmit_FS(Buffer, 6);
HAL_Delay(2000);
}
I only added the above code to the project created by STM32cubeMX but it didn't work.
STM library is buggy and it stalls when you for example try to send many larger packets of data.
There is a problem with the windows drivers and there are quite long delays between packets. So 12MB is quite difficult to archive - using CubeMx I could only have about 3-4Mb (12MB when packet is sent).
Another problem I had - I needed to send some data to the device bofore I could transmit next packet (max 8kB in my case), otherwise it stalled randomly.
Fortunately, the problem is solved and I can receive data in the PC from the STM32. There was a problem in my terminal software. I used serial port manitor to monitor the received data from the serial port, however this serial monitor software do not open the serial port by itself and if any other software opens the serial port and receives the data, it monitors data receptions. I didn't know that.
Thanks

How to write Linux kernel module for serial communication to arduino?

I have got Arduino MEGA 2560. What I would like to do is to send a signal to Arduino via serial port to light specified LED up. However, I cannot find any documentation about this. What steps should I follow?
I think first, I need to compile the driver of Arduino and add it to Linux kernel. Second, I have to find some header files to use them in module. Then, I have to find functions to start serial communication and to light LEDs up. However, these are just my thoughts.
Any advice will be appreciated.
The arduino-mega (the one with ATmega2560) documentation is here:
https://www.arduino.cc/en/Main/ArduinoBoardMega2560#documentation
The serial communication via UART:
https://www.arduino.cc/en/Reference/SoftwareSerial
Since there are other ways for serial communication with the ATmega please read the documentation [above] and compare that to your exercise sheet.
I think such a kernel module is already available - and used by the arduino-ide.

Modbus rtu slave is not responding to modbus rtu master

https://code.google.com/p/stm32modbus/source/browse/#svn%2Ftrunk%2F%20stm32modbus%20--username%20ickingdom%40gmail.com%253Fstate%253Dclosed
I am using this program.I debug and compile it successfully no error i got then i burn it into my prototype slave which has stm32f103c6 microcontroller. Then with help of docklight software i send request to my salve but its not responding. What should i do?
I set baud rate of master and slave same so that is not the issue.
I was thinking like may be program has some error but i didn't get it. So please help me to find any missing thing in this program which i have downloaded from google code which link i have shown above.Is there any alternative that you want to suggest then please suggest me.
Try to remove the CRC request on input data and then try communicating via docklight, please be sure that the CRC module of the code is working properly.

GSM AT command response in between downlink data

I have a weird problem that I can't figure out in SIMCOM900A, I am receiving downlink data of about 1080 bytes every 5 seconds, meanwhile doing other things like sending data to server. However, sometimes AT command response comes in between downlink data. Like below:- ## to ## is my downlink packet but I receive AT+CSQ response in between!
##10500000110483&A8813&B182&C1027&D~OTA_S|True|InProcess|182|YCrOK/Uei1R/CKZSAmV+EkjvShKck+ko7zPYP0y7vULiXaPY6H6FeJx47QtXM+0+vAInJ7svI9nQVljeKO9oaDmPU5Qp6p2Yp2GSGbMlvqJhshlTEpcH+6dG759Oev/YBfoNYPg76IG7Ufd1hl7msQshJvQLCdcvYuZKv1xfSFH0xcUR9EVU7UBQO8CYP0HIPQb98JhhvJ6XqrVHQph+6JSq6YcEmCU9YG7ANaaHpX7Q+CXq/C7W+dmFru6VytvXpyRQbnEoSZDA4jx6MbM4vZjFgb6laHEocUl9JbA4wy8Gjeil6MX1Ae/MeI9zWkItwWgxSOM2VuIWpzNBe3MnpOwocXvDcnH/QsI2xHvUsxeT4RK0pLSvGVvSJ2G+TuZ80L54xfa9mCRu0tt3Pf/doPMt2neo3h6dw2zX46m/NdvVmfVCS9muTL3tLtHbziEs0TzA8H28w2m9nCB1htF0H/RRsvcBWeuhTuC3XAn5A3eCZN6LQKNjLEGCdcHdSDmP1bOD/D5bF/QCaS8GnWCYNewnN1uLenUx2MCiVM0GXgo28LKw9cK7gA81rBcuM60XBlNOM64XRhCkBbIus1gvXBZhvXAptLYPpHDZuJ95qd76LblmuFRfM7SlP3/NcJlpzWCUM8lCTqs1w+nkbJl1w6X6usEs55msGy4zrRseMMjZPaqcoeuG08l6JmuHS/W1g1mSM1s7aOPcNl4b54kwzruE+Xqtx2u+XiL4el2gfWOp0ddrO16bv33CfL2O4618vT5gZ26N4OshdpPw2nhc89rw7nbh6/F40NeLmqtnH7jrf9a+Xh9dvr5h+x4DATuf7Xb0hTLw18EwxnclkHIDNe9K3MraThZt/yfI70bevmvJ0Nh+jD+FGgzzXsP6SNM190O6wQZd08+ka26knGbUNU8SpAWy+lnomn6WumbIzGvEWvZaGI99WlzHXKvrmOv
+CSQ: 10,0
OK
OQsf0M+kYo3xJFvKF65jI8rWMbrlW1y3XnYVu6WfS~##
Any suggestions as to why this is happening or how to fix it are welcome! Thanks in advance.
This is a configurational issue. Basically with SIMCOM900A you are limited to two serial interfaces if my memory serves me right. One for AT commands and modem control, the second for debugging.
As you have setup a data connection via the AT command interface it is effectively sharing the interface for incoming/outgoing data communication and modem control commands. What you are seeing with the +CSQ messages are unsolicited (URC) result codes.
You basically have two options:
1) Make use of multiplexing via GSM 07.10 which your modem supports. These then connects to your modem and configures using AT+CMUX so that you will have effectively two ways of connecting to the same serial device.
Thereafter you can use one for managing the modem and sending/receiving AT commands and responses. And the second for receiving/sending pure data (you can also execute AT commands in this channel but there are limitations).
2) Modify your host program/script to cope with this situation and make decisions on what to do based on whether it is data or AT command responses / unsolicited response codes.
NOTE: A word of warning regarding multiplexing. By multiplexing you will end up degrading the performance of communication between the modem and host.
NOTE: It makes real sense always to have a good read through of your modems manual regarding interfacing and AT commands. Manufacturers are renowned for implementing slightly differently compared to the GSM specs :)

Resources