i’m currently using rak3172 and stm32g030 to create a project.
i’m trying to use p2p mode of rak3172, but ‘AT+PSEND’ is not working properly.
i have set one device as receiver by ‘AT+PRECV=65534’ and it returns ‘OK’, and the other device as transmitting device, but psend is not working.
if i send ‘AT+PSEND?’, it returns ‘OK’, but when i try to send data using psend, it returns ‘LoRa (R) is a registered trademark or service mark blah blah blah…’, and the receiver does not receives anything.
both of the device has the same setting ‘AT+NWM=0’, ‘AT+P2P=868000000:9:125:0:8:15’, ‘AT+PRECV=65534’(receiver), ‘AT+PRECV=0’(transmitter).
what should i do to communicate via p2p mode?
Hello @ikpyo.han , welcome to the forum.
How do you use AT+PSEND? Can you post the exact command you are using.
AT+PSEND requires the data to be in ASCII HEX format.
Example:
AT+PSEND=11223344
will send 4 bytes with the values of 0x11, 0x22, 0x33 and 0x44
i’m currently using eclipse to do my work
these are the PSEND code i’m currently using
strcpy(atcheck, "AT+PSEND=11223344\r\n");
while(1){
cpu_delay_ms(10);
HAL_UART_Transmit_IT(&rcpu_huart1,( uint8_t * ) atcheck,strlen( atcheck ));
cpu_delay_ms(1);
HAL_UART_Receive_IT(&rcpu_huart1, ( uint8_t * ) UartRxMemory01,sizeof(UartRxMemory01));
cpu_delay_ms(10);
char *atok = strstr((const char*) UartRxMemory01, "OK");
if(atok != NULL)
{
cnt++;
break;
}
If I understand your code correct, you are overloading the RAK3172 with UART traffic
wait 10ms
transmit SEND command
wait 1ms
Check for RECEIVE
wait 10ms
then repeat
Sending a LoRa Packet takes time (depending on the packet size .
After AT+PSEND, you should at least wait for the OK response from the RAK3172 before sending the next commands.
In addition, calculating the air time with the Semtech calculator tool, the 4 byte packet has an on-air time of 123ms with your LoRa settings:
You are not even waiting for the first packet to be transmitted when you try to send again.
Try to slow down your sending loop, LoRa is not a racing car.
i try to slow down
strcpy(atcheck, “AT+PSEND=33\r\n”);
cpu_delay_ms(100);
HAL_UART_Transmit_IT(&rcpu_huart1,( uint8_t * ) atcheck,strlen( atcheck ));
cpu_delay_ms(100);
HAL_UART_Receive_IT(&rcpu_huart1, ( uint8_t * ) UartRxMemory01,sizeof(UartRxMemory01));
cpu_delay_ms(100);
but i’m getting same result
It works for me, but itwill need more investigation. There seems to be a bug in the RAK3172 with the AT+PRECV command.
I have only one RAK3172 to test, so the other P2P board is a RAK4631.
RAK3172 sending, RAK4631 listening is just fine:
RAK4631 sending, RAK3172 listening works only once
I will have to send this issue to our R&D guys. Seems the AT+PRECV=65534 is not working as expected.
But P2P receiving works in principal.
Please update the RAK3172 to the latest firmware version.
Guide for update
Latest firmware
On V1.0.3 it works fine:
I would first try with AT commands from a serial terminal to confirm that your two devices are working properly in P2P mode.
i have updated the firmware to the latest version and retry.
i’ve connected one module on my circuit board, and the other one to my pc
the strange thing is that, when pc-connected module is used as sender, it works fine
pc send worked and circuit receive worked
but when i use the circuit-connected module as sender, it shows same result as before
and pc received nothing
That doesn’t look like the latest firmware version:
Are you sure you successfully updated both modules?
yes the version was right, i posted wrong picture
anyway i’ve solved the garbage value issue, the psend command returns OK now.
but receiver does not receive any value
So the status is
Module 1: Can receive and maybe send
Module 2: Can send but not receive
Both modules have the antenna connected correct?
On RX, what RSSI and SNR values do you see?
Does it change if you switch the modules (circuit => PC, PC => circuit)?
i finally solved this issue, the problem was power supply.
i was testing the rak module using the circuit for esp8266.
the circuit was able to supply stable power source to esp8266 wifi module, but not to rak3172.
right after i changed the power supplying method, the rak module worked.
the unstable power supply cause reset when psend was sent to receiver.
that was the reason for this return
anyway thanks a lot for helping me out, have a great day!