RN 52 AT command not working

Hello,

I am using RN-52 with Raspberry Pi 3 b+, i am trying to do a call using AT command, i have written a code for the same, whenever i am running the code it returns me " ! ".

Please help me regarding this.

import serial
#import RPi.GPIO as GPIO
import time

ser = serial.Serial ("/dev/ttyUSB0", 9600 )    #Open port with baud rate
#cmd = (bytes('A,8296239393'.encode('ascii')))
cmd = "A,8296239393"
#dis = "D"
ser.write(cmd) #transmit AT COMMAND serially
print("AT command Transmitted")
print(cmd)
print(ser.read())

Hi Diptesh,

While we cannot help you debug your code, I do have a couple of suggestions that might help. First, your baud rate of 9600 may be the issue here since the RN-52 defaults to 115200. Unless you manually changed that already over a UART or other serial connection like we cover in [this section of our Hookup Guide for the RN-52 Breakout, you will need to switch to 115200 or else you will have a baud rate mismatch.

The other suggestion is to make sure the module is in CMD mode by pulling GPIO9 low either via software or by physically grounding that pin. Again, this is covered in the Hookup Guide for the breakout.

I hope this helps point you in the right direction.](https://learn.sparkfun.com/tutorials/rn-52-bluetooth-hookup-guide#c)

Thanks Mark,

Now i am having a working code, i forgot to declare the BAUDRATES and TIMEOUT and etc. in ser configuration. and also need to cange the ser.write part of code.

import serial
import time
ser = serial.Serial (port='/dev/serial0', baudrate=115200,bytesize=serial.EIGHTBITS,stopbits=serial.STOPBITS_ONE,timeout=2,write_timeout=2)    #Open port with baud rate

ser.write(b'A,9038xxxxxx\n')
res = ser.read(4)

print('AT command Transmitted') #Just to check above codes are working
print (res.decode())
print('checked')

ser.close()