Go Down

Topic: RN4020 BTLE module (Read 14453 times) previous topic - next topic

Owais

Hello all,

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.

Regards.
Owais

remkooo

#1
Jan 07, 2015, 09:48 pm Last Edit: Jan 07, 2015, 09:56 pm by remkooo
Hey Owais,

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:
PinRN4020Microcontroller
23VDD3.3V
1,9,16,24GNDGround
7WAKE_SW3.3V
15WAKE_HW3.3V
5UART_TXRX
6UART_RXTX


Code: [Select]
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.

Remko

Owais

Thanks for the response and info remkooo,

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.

spudz000

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.

RN4020 Users Guide

I'm currently using this radio in MLDP mode for a company project, seems to work great. 

Ze_L

Hello all

I'm new working with microcontrollers with Ble. I tried a simple command like:     
     
    Serial.println("SN,MyDevice");

to change the DeviceName of the rn4020 and nothing have changed.
Can you help me with basics infos to start working?

Thanks all.
best regards

PS: I put the command SN between the command SR an R.
After the reboot to the chip sets the info. I guess.. :S

t_bostanjyan

Thanks for the response and info remkooo,

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.

Thank you very much.

lbk92

hi,

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)
     {}
   
  }
 
  USART_SendData(BLE_USART1, (uint8_t) '\n'); // carrige return

  return ch;
}

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

hanksss

efim777

Did you manage to do it?

Hello all

I'm new working with microcontrollers with Ble. I tried a simple command like:     
     
    Serial.println("SN,MyDevice");

to change the DeviceName of the rn4020 and nothing have changed.
Can you help me with basics infos to start working?

Thanks all.
best regards

PS: I put the command SN between the command SR an R.
After the reboot to the chip sets the info. I guess.. :S


Go Up