2022-11-06 11:54 PM
I made a wifi server with RTL8720DN and connected it to hercules client to send and receive messages, but I can't send them
It worked well to make it a client, send and receive messages from the server,
It's a problem sending it to the server
I don't know what this is
How can I send it to the seed?
That's what I've been doing
Code
void send_data ( UART_HandleTypeDef *_uart, int32_t _dataSize, uint8_t *_conId, uint8_t *_data)
{
uint8_t param_buf[ 100 ] = { 0 };
uint8_t quatation_mark[ 2 ] = { '\"', 0 };
uint8_t comma[ 2 ] = { ',', 0 };
uint8_t colon[ 2 ] = { ':', 0 };
int send_size = 0;
int len = 0;
sprintf(param_buf, "%d", _dataSize);
strcat( param_buf, comma );
strcat( param_buf, _conId );
strcat( param_buf, colon );
len = strlen(param_buf);
//hex값�?� 전송하기 위해서 memcpy 사용
memcpy(param_buf+len, _data, _dataSize);
//�?성�?� 버�?� 길�?�
len = len + _dataSize;
parameter( _uart, bw_ATPT, param_buf, len, 500);
}
void parameter ( UART_HandleTypeDef *_uart, uint8_t *at_cmd_buf, uint8_t *param_buf, int send_size, int timer)
{
uint8_t final_cmd[ DRV_TX_BUFFER_SIZE ] = { 0 };
uint8_t check_char[ 2 ] = { '=', 0 };
int cmd_len = 0;
strcpy( final_cmd, at_cmd_buf );
strcat( final_cmd, check_char );
cmd_len = strlen(final_cmd);
// hex값�?� 복사하기 위해 memcpy 사용
memcpy( final_cmd + cmd_len, param_buf, send_size );
//�?성�?� 버�?� 길�?�
cmd_len = send_size + cmd_len;
cmd(_uart, final_cmd, cmd_len, timer);
}
int cmd ( UART_HandleTypeDef *_uart, uint8_t * _cmd , int _cmdSize, int timer)
{
uint8_t SENDCR1[2] = {0x0d,0x0a};
HAL_UART_Transmit(_uart, _cmd, _cmdSize, 0xff);
HAL_UART_Transmit(_uart, SENDCR1, 2, 0xff);
HAL_Delay(timer);
return 0;
}
sliceBuf[3] = {0xFF, 0XFF, 0xFF};
send_data (&huart5, 3, bw16ConID, sliceBuf);
Note Links : https://docs.ai-thinker.com/_media/rtl8710/docs/rtl8720d-at%E6%8C%87%E4%BB%A4%E6%89%8B%E5%86%8Cv2.4.1-20190814.pdf