How to transfer data between two STM32+SX1272 LoRa module
Hello everyone. I am debugging the STM32+SX1272 LORA wireless communication. Now I follow the sample code provided by ST company which download from the website. The sample code version is STM32CubeExpansion_LRWAN_V1.3.1.
Now I can transfer "ping" and "pong" between two modules using the sample code.
As I understand, there is a buffer which size is 64 which is define to transfer data. It is defined below.
#define BUFFER_SIZE 64 // Define the payload size here
uint16_t BufferSize = BUFFER_SIZE;
uint8_t Buffer[BUFFER_SIZE];
As I understand, in the main loop, when the state = RX the data transferred in is stored in the Buffer array and prepare the next frame data for the transmission.
if (strncmp((const char *)Buffer, (const char *)PongMsg, 4) == 0)
{
TimerStop(&timerLed);
LED_Off(LED_BLUE);
LED_Off(LED_GREEN) ;
LED_Off(LED_RED1) ;
// Indicates on a LED that the received frame is a PONG
LED_Toggle(LED_RED2) ;
// Send the next PING frame
Buffer[0] = 'P';
Buffer[1] = 'I';
Buffer[2] = 'N';
Buffer[3] = 'G';
// We fill the buffer with numbers for the payload
for (i = 4; i < BufferSize; i++)
{
Buffer[i] = i - 4;
}
PRINTF("...PING2\n\r");
DelayMs(1);
Radio.Send(Buffer, BufferSize);
}
Now I have a question, If I make an analog and digital conversion and get some data. How can I put the data in the Buffer array and transmit data to another node. How can I use PRINTF function to transmit the data to the computer via USB communication. I don't know how to use PRINTF function. It seems relative to the function of Trace.
Any help will be appreciated.
Best regards,