Has anyone here tried connecting RN4020 BTLE module from Microchip to DUE. I have recently started working with it and have some trouble figuring out how to communicate with it. If someone has worked with it before please share your experience. Thanks.
I have never worked with the due specifically, but it should work the same.
I've just started working with the RN4020 too, I've got the basics working right now.
I've connected the RN4020 to an ATMEGA328p like this:
Pin
RN4020
Microcontroller
23
VDD
3.3V
1,9,16,24
GND
Ground
7
WAKE_SW
3.3V
15
WAKE_HW
3.3V
5
UART_TX
RX
6
UART_RX
TX
void setup(){
Serial.begin(115200);
delay(1000);
Serial.println("SR,20000000"); //Set device in peripheral mode and set turn on auto advertising
Serial.println("R,1"); //Reboot
delay(500);
Serial.println("A"); //Start advertising
}
Now it should be advertising and you should be able to find it using your smartphone.
Using the commands found in the datasheet you should be able to get it working the way you want.
I was able to set the RN4020 up and send commands to it and everything was working fine. I can even set it up in MLDP mode so that I can send/receive serial data to/from my Android. I am using the MLDPTerminal APP provided by Microchip for this purpose. I am just looking for the source code for this APP which I am still unable to find anywhere. If you know where I could find the source code for this APP please do let me know.
There is an easy example in the RN4020's user guide (Chapter 3) on how to connect two radios and what commands to send step by step. I'd be willing to bet their program uses this, but you should read this first.
I was able to set the RN4020 up and send commands to it and everything was working fine. I can even set it up in MLDP mode so that I can send/receive serial data to/from my Android. I am using the MLDPTerminal APP provided by Microchip for this purpose. I am just looking for the source code for this APP which I am still unable to find anywhere. If you know where I could find the source code for this APP please do let me know.
Regards.
Hi Owais,
Could you please tell me your setup? I'm not able to connect to the MLDP terminal app provided by Microchip.
I can see my device but when I'm trying to connect to RN4020 the APP complains that MLDP is not enabled.
I am using rn4020 and I am trying to save data i receive,
for eg: i send shw,handle,99 from the fisrt module
in the second i send shr,handle and i want to read the value, but i can't
to send, i am using
int write_ble_string(char *s)
{
char ch;
while(ch = *s++) {
USART_SendData(BLE_USART1, (uint8_t) ch);
// Loop until the end of transmission
while (USART_GetFlagStatus(BLE_USART1, USART_FLAG_TC) == RESET)
{}
and It works well
but to receive, i am using:
while (USART_GetFlagStatus(BLE_USART1, USART_FLAG_RXNE) == RESET ){
}
i = USART_ReceiveData(BLE_USART1);
and i can't get the good values