mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
update link layer manager + rip + rmt
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
*
|
||||
* @param board_id Board ID of the current board. Will be written to the NVM under key "board" if not already written.
|
||||
*/
|
||||
DataLinkManager::DataLinkManager(uint8_t board_id){
|
||||
DataLinkManager::DataLinkManager(uint8_t board_id, uint8_t num_channels = MAX_CHANNELS){
|
||||
//init table for this board and set up link layer priority queue
|
||||
phys_comms = std::make_unique<RMTManager>();
|
||||
phys_comms = std::make_unique<RMTManager>(num_channels);
|
||||
if (phys_comms == nullptr){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "RMT object was not created. Link layer communications will not function.");
|
||||
return;
|
||||
@@ -22,11 +22,13 @@ DataLinkManager::DataLinkManager(uint8_t board_id){
|
||||
set_board_id(this_board_id);
|
||||
}
|
||||
|
||||
if (this_board_id != board_id){
|
||||
//NVM board id is different from `board_id` -> update entry to the new board id
|
||||
this_board_id = board_id;
|
||||
set_board_id(this_board_id);
|
||||
}
|
||||
// if (this_board_id != board_id){
|
||||
// //NVM board id is different from `board_id` -> update entry to the new board id
|
||||
// this_board_id = board_id;
|
||||
// set_board_id(this_board_id);
|
||||
// }
|
||||
|
||||
this->num_channels = num_channels;
|
||||
|
||||
init_rip();
|
||||
}
|
||||
@@ -41,7 +43,6 @@ esp_err_t DataLinkManager::set_board_id(uint8_t board_id){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
|
||||
nvs_handle_t handle;
|
||||
esp_err_t res = nvs_open("board", NVS_READWRITE, &handle);
|
||||
if (res != ESP_OK){
|
||||
@@ -118,10 +119,12 @@ esp_err_t DataLinkManager::send(uint8_t dest_board, uint8_t* data, uint16_t data
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (curr_channel >= MAX_CHANNELS){
|
||||
if (curr_channel >= num_channels){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t res;
|
||||
|
||||
if (IS_CONTROL_FRAME(static_cast<uint8_t>(type))){
|
||||
//control frame
|
||||
if (data_len > MAX_CONTROL_DATA_LEN){
|
||||
@@ -157,6 +160,7 @@ esp_err_t DataLinkManager::send(uint8_t dest_board, uint8_t* data, uint16_t data
|
||||
send_data[offset++] = (new_frame.seq_num >> 8) & 0xFF;
|
||||
send_data[offset++] = new_frame.type_flag;
|
||||
send_data[offset++] = new_frame.data_len;
|
||||
send_data[offset++] = (new_frame.data_len >> 8) & 0xFF;
|
||||
|
||||
memcpy(&send_data[offset], data, new_frame.data_len);
|
||||
|
||||
@@ -178,7 +182,18 @@ esp_err_t DataLinkManager::send(uint8_t dest_board, uint8_t* data, uint16_t data
|
||||
// printf("sending message:\n");
|
||||
// print_buffer_binary(send_data, frame_size);
|
||||
|
||||
phys_comms->send(send_data, offset, &config, curr_channel);
|
||||
uint8_t channel_to_route = MAX_CHANNELS;
|
||||
if (new_frame.receiver_id == BROADCAST_ADDR){
|
||||
channel_to_route = curr_channel;
|
||||
} else {
|
||||
res = route_frame(new_frame.receiver_id, &channel_to_route);
|
||||
|
||||
if (res != ESP_OK){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Failed to find entry for %d", new_frame.receiver_id);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
}
|
||||
phys_comms->send(send_data, offset, &config, channel_to_route);
|
||||
|
||||
//can wait for the rmt to finish
|
||||
// esp_err_t res = phys_comms->wait_until_send_complete(curr_channel); //this cannot be here in deployment but until the RMT manager can hold this copy of data this will have to be here
|
||||
@@ -219,7 +234,7 @@ void DataLinkManager::print_buffer_binary(const uint8_t* buffer, size_t length)
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t DataLinkManager::start_receive_frames(uint8_t curr_channel){
|
||||
if (curr_channel >= MAX_CHANNELS){
|
||||
if (curr_channel >= num_channels){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
return phys_comms->start_receiving(curr_channel);
|
||||
@@ -231,11 +246,13 @@ esp_err_t DataLinkManager::receive(uint8_t* data, size_t data_len, size_t* recv_
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (curr_channel >= MAX_CHANNELS){
|
||||
if (curr_channel >= num_channels){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Invalid channel");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (data_len < MAX_CONTROL_DATA_LEN + CONTROL_FRAME_OVERHEAD){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Receive data buffer len is too small");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@@ -253,35 +270,46 @@ esp_err_t DataLinkManager::receive(uint8_t* data, size_t data_len, size_t* recv_
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
//check for a rip frame
|
||||
if (static_cast<FrameType>((data[5])) == FrameType::RIP_TABLE_CONTROL){
|
||||
printf("Got a RIP frame\n");
|
||||
uint8_t rip_message[rip_table_valid_rows*2] = {};
|
||||
size_t rip_message_size = 0;
|
||||
uint8_t* message = (uint8_t*)pvPortMalloc(CONTROL_FRAME_OVERHEAD + MAX_CONTROL_DATA_LEN);
|
||||
if (message == nullptr){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Failed to malloc for receive");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
memset(message, 0, sizeof(message));
|
||||
size_t message_size = 0;
|
||||
frame_header header;
|
||||
res = get_data_from_frame(data, *recv_len, message, &message_size, &header);
|
||||
if (res != ESP_OK){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Received frame destined for board %d", header.receiver_id);
|
||||
|
||||
res = get_data_from_frame(data, *recv_len, rip_message, &rip_message_size);
|
||||
//check for a rip frame
|
||||
if (static_cast<FrameType>(header.type_flag) == FrameType::RIP_TABLE_CONTROL){
|
||||
printf("Got a RIP frame\n");
|
||||
|
||||
if (res != ESP_OK){
|
||||
return ESP_FAIL; //crc or data len failed
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < rip_message_size-1; i+=2){
|
||||
uint8_t board_id = rip_message[i];
|
||||
uint8_t hops = rip_message[i+1];
|
||||
printf("Received: board_id %d and number of hops %d on channel %d\n", board_id, hops, curr_channel);
|
||||
for (size_t i = 0; i < message_size-1; i+=2){
|
||||
uint8_t board_id = message[i];
|
||||
uint8_t hops = message[i+1];
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Received: board_id %d and number of hops %d on channel %d", board_id, hops, curr_channel);
|
||||
|
||||
RIPRow* entry = nullptr;
|
||||
|
||||
res = rip_find_entry(board_id, &entry);
|
||||
res = rip_find_entry(board_id, &entry, true);
|
||||
if (res != ESP_OK){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (entry == nullptr){
|
||||
printf("rip pointer\n");
|
||||
return ESP_FAIL; //no room for more entries in the table
|
||||
}
|
||||
|
||||
if (entry->valid == RIP_INVALID_ROW){
|
||||
if (entry->valid == RIP_NEW_ROW){
|
||||
//adding a new entry
|
||||
rip_add_entry(board_id, hops + 1, curr_channel, &entry);
|
||||
} else {
|
||||
@@ -292,10 +320,18 @@ esp_err_t DataLinkManager::receive(uint8_t* data, size_t data_len, size_t* recv_
|
||||
*recv_len = 0;
|
||||
}
|
||||
|
||||
//got frame but not destined for this board
|
||||
if (header.receiver_id != this_board_id && header.receiver_id != BROADCAST_ADDR && header.seq_num != sequence_num_map[header.receiver_id]){
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Sending message to board %d with message %s", header.receiver_id, message);
|
||||
res = send(header.receiver_id, message, message_size, FrameType::DEBUG_CONTROL_TYPE, curr_channel);
|
||||
*recv_len = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t DataLinkManager::get_data_from_frame(uint8_t* data, size_t data_len, uint8_t* message, size_t* message_size){
|
||||
esp_err_t DataLinkManager::get_data_from_frame(uint8_t* data, size_t data_len, uint8_t* message, size_t* message_size, frame_header* header){
|
||||
if (data == nullptr){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Invalid data array");
|
||||
return ESP_FAIL;
|
||||
@@ -308,29 +344,31 @@ esp_err_t DataLinkManager::get_data_from_frame(uint8_t* data, size_t data_len, u
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Invalid message size ptr");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
if (header == nullptr){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Invalid header ptr");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (IS_CONTROL_FRAME(data[5])){
|
||||
control_frame temp = {0};
|
||||
header->preamble = data[0];
|
||||
header->sender_id = data[1];
|
||||
header->receiver_id = data[2];
|
||||
header->seq_num = (uint16_t)data[3] | ((uint16_t)data[4] << 8);
|
||||
header->type_flag = data[5];
|
||||
header->data_len = (uint16_t)data[6] | ((uint16_t)data[7] << 8);
|
||||
|
||||
temp.preamble = data[0];
|
||||
temp.sender_id = data[1];
|
||||
temp.receiver_id = data[2];
|
||||
temp.seq_num = (uint16_t)data[3] | ((uint16_t)data[4] << 8);
|
||||
temp.type_flag = data[5];
|
||||
temp.data_len = data[6];
|
||||
|
||||
if (temp.data_len > data_len){
|
||||
if (header->data_len > data_len){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Mismatch data length in control frame");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
*message_size = temp.data_len;
|
||||
*message_size = header->data_len;
|
||||
|
||||
memcpy(temp.data, &data[7], temp.data_len);
|
||||
memcpy(message, &data[7], temp.data_len);
|
||||
memcpy(message, &data[8], header->data_len);
|
||||
|
||||
geneate_crc_16(data, 7*sizeof(uint8_t) + temp.data_len, &temp.crc_16);
|
||||
geneate_crc_16(data, 8*sizeof(uint8_t) + header->data_len, &header->crc_16);
|
||||
|
||||
if (((uint16_t)data[7 + temp.data_len] | ((uint16_t)data[8 + temp.data_len] << 8)) != temp.crc_16){
|
||||
if (((uint16_t)data[8 + header->data_len] | ((uint16_t)data[9 + header->data_len] << 8)) != header->crc_16){
|
||||
//CRC mismatch
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "CRC Mismatch");
|
||||
return ESP_FAIL;
|
||||
@@ -382,8 +420,10 @@ esp_err_t DataLinkManager::print_frame_info(uint8_t* data, size_t data_len, uint
|
||||
|
||||
size_t message_size;
|
||||
|
||||
frame_header temp;
|
||||
|
||||
// print_buffer_binary(data, data_len);
|
||||
return get_data_from_frame(data, data_len, message, &message_size);
|
||||
return get_data_from_frame(data, data_len, message, &message_size, &temp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,6 +440,7 @@ void DataLinkManager::init_rip(){
|
||||
.channel = MAX_CHANNELS + 1, //invalid channels
|
||||
.ttl = 0,
|
||||
.valid = RIP_INVALID_ROW,
|
||||
.ttl_flush = 0,
|
||||
.row_sem = NULL
|
||||
};
|
||||
|
||||
@@ -415,26 +456,22 @@ void DataLinkManager::init_rip(){
|
||||
rip_table[0].ttl = RIP_TTL_START;
|
||||
rip_table[0].valid = 1;
|
||||
|
||||
rip_table_valid_rows++;
|
||||
|
||||
//temp debug
|
||||
rip_table[1].info = {
|
||||
.board_id = 69,
|
||||
.hops = 69,
|
||||
};
|
||||
rip_table[1].channel = MAX_CHANNELS + 1;
|
||||
rip_table[1].ttl = RIP_TTL_START;
|
||||
rip_table[1].valid = 1;
|
||||
rip_table_valid_rows++;
|
||||
// rip_table[1].info = {
|
||||
// .board_id = 2,
|
||||
// .hops = 1,
|
||||
// };
|
||||
// rip_table[1].channel = 0;
|
||||
// rip_table[1].ttl = RIP_TTL_START;
|
||||
// rip_table[1].valid = 1;
|
||||
|
||||
rip_table[2].info = {
|
||||
.board_id = 3,
|
||||
.hops = 2,
|
||||
};
|
||||
rip_table[2].channel = MAX_CHANNELS + 1,
|
||||
rip_table[2].ttl = RIP_TTL_START,
|
||||
rip_table[2].valid = 1;
|
||||
rip_table_valid_rows++;
|
||||
// rip_table[2].info = {
|
||||
// .board_id = 1,
|
||||
// .hops = 2,
|
||||
// };
|
||||
// rip_table[2].channel = 0,
|
||||
// rip_table[2].ttl = RIP_TTL_START,
|
||||
// rip_table[2].valid = 1;
|
||||
|
||||
start_rip_tasks();
|
||||
}
|
||||
@@ -468,7 +505,7 @@ esp_err_t DataLinkManager::rip_reset_entry_ttl(uint8_t board_id){
|
||||
|
||||
esp_err_t res;
|
||||
|
||||
res = rip_find_entry(board_id, &entry);
|
||||
res = rip_find_entry(board_id, &entry, false);
|
||||
if (res != ESP_OK){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@@ -497,14 +534,15 @@ esp_err_t DataLinkManager::rip_update_entry(uint8_t new_hop, uint8_t channel, RI
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (new_hop < (*entry)->info.hops){
|
||||
if ((*entry)->info.hops > new_hop && (*entry)->info.hops != RIP_MAX_HOPS + 1){ //no count to infinity if path is invalid
|
||||
(*entry)->info.hops = new_hop;
|
||||
(*entry)->channel = channel;
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "updated board_id %d now has hops %d from channel %d", (*entry)->info.board_id, (*entry)->info.hops, channel);
|
||||
}
|
||||
(*entry)->ttl = RIP_TTL_START;
|
||||
(*entry)->valid = 1;
|
||||
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "board_id %d now has hops %d from channel %d", (*entry)->info.board_id, (*entry)->info.hops, channel);
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "refreshed board_id %d ttl", (*entry)->info.board_id);
|
||||
|
||||
xSemaphoreGive((*entry)->row_sem);
|
||||
|
||||
@@ -512,37 +550,59 @@ esp_err_t DataLinkManager::rip_update_entry(uint8_t new_hop, uint8_t channel, RI
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Finds the board_id in the table. If board_id does not exist in the table, `entry` will contain an empty row to write into.
|
||||
* @brief Finds the board_id in the table if it exists and stores that row in `entry`
|
||||
* TODO: use an unordered map instead of an array?
|
||||
*
|
||||
* @param board_id
|
||||
* @param entry
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t DataLinkManager::rip_find_entry(uint8_t board_id, RIPRow** entry){
|
||||
esp_err_t DataLinkManager::rip_find_entry(uint8_t board_id, RIPRow** entry, bool reserve_row = false){
|
||||
RIPRow* free_slot = nullptr;
|
||||
for (size_t i = 0; i < RIP_MAX_ROUTES; i++){
|
||||
if (xSemaphoreTake(rip_table[i].row_sem, (TickType_t)RIP_MAX_SEM_WAIT) != pdTRUE){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
if (rip_table[i].valid != RIP_INVALID_ROW && rip_table[i].info.board_id == board_id){
|
||||
if (rip_table[i].valid == RIP_VALID_ROW && rip_table[i].info.board_id == board_id){
|
||||
*entry = &rip_table[i];
|
||||
xSemaphoreGive(rip_table[i].row_sem);
|
||||
break;
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Found %d in table at row %d", board_id, i);
|
||||
return ESP_OK;
|
||||
}
|
||||
if (rip_table[i].valid == RIP_INVALID_ROW){
|
||||
*entry = &rip_table[i];
|
||||
if (rip_table[i].valid == RIP_INVALID_ROW && free_slot == nullptr){
|
||||
free_slot = &rip_table[i];
|
||||
}
|
||||
xSemaphoreGive(rip_table[i].row_sem);
|
||||
}
|
||||
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Finished looking for %d in table", board_id);
|
||||
|
||||
if (!reserve_row){
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (free_slot != nullptr){
|
||||
if (xSemaphoreTake(free_slot->row_sem, RIP_MAX_SEM_WAIT) != pdTRUE) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
// IMPORTANT: Mark it as taken so others don't grab it
|
||||
free_slot->valid = RIP_NEW_ROW; // Or some other init state
|
||||
free_slot->info.board_id = board_id;
|
||||
*entry = free_slot;
|
||||
|
||||
xSemaphoreGive(free_slot->row_sem);
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Reserved new entry for board %d", board_id);
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t DataLinkManager::broadcast_rip_frame(){
|
||||
esp_err_t DataLinkManager::broadcast_rip_frame(bool manual_broadcast = false){
|
||||
//use the control frame for the demo (as the number of rows increase, we will need to use the generic frame)
|
||||
//data will be [board_id (1), hops (1), board_id (2), hops (2), ...]
|
||||
|
||||
uint8_t rip_message[rip_table_valid_rows*2] = {};
|
||||
uint8_t rip_message[RIP_MAX_ROUTES*2] = {};
|
||||
size_t message_idx = 0;
|
||||
|
||||
for (size_t i = 0; i < RIP_MAX_ROUTES; i++){
|
||||
@@ -552,15 +612,31 @@ esp_err_t DataLinkManager::broadcast_rip_frame(){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rip_table[i].info.hops == RIP_MAX_HOPS + 1){
|
||||
//invalid hop, decrement counter
|
||||
rip_table[i].ttl_flush--;
|
||||
if (rip_table[i].ttl_flush == 0 && !manual_broadcast){
|
||||
rip_table[i].valid = RIP_INVALID_ROW;
|
||||
xSemaphoreGive(rip_table[i].row_sem);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// //test to ensure routing works
|
||||
// if (rip_table[i].info.board_id == 25){
|
||||
// rip_message[message_idx++] = 25;
|
||||
// rip_message[message_idx++] = 10;
|
||||
// } else {
|
||||
rip_message[message_idx++] = rip_table[i].info.board_id;
|
||||
rip_message[message_idx++] = rip_table[i].info.hops;
|
||||
// }
|
||||
|
||||
xSemaphoreGive(rip_table[i].row_sem);
|
||||
}
|
||||
|
||||
esp_err_t res;
|
||||
|
||||
for (uint8_t channel = 0; channel < MAX_CHANNELS; channel++){
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "sending type %x",static_cast<uint8_t>(FrameType::RIP_TABLE_CONTROL));
|
||||
for (uint8_t channel = 0; channel < num_channels; channel++){
|
||||
res = send(BROADCAST_ADDR, rip_message, message_idx, FrameType::RIP_TABLE_CONTROL, channel);
|
||||
if (res != ESP_OK){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Failed to send rip frame on channel %d", channel);
|
||||
@@ -570,9 +646,35 @@ esp_err_t DataLinkManager::broadcast_rip_frame(){
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determines which channel to route the frame to, depending on the dest (board) id
|
||||
*
|
||||
* @param dest_id
|
||||
* @param channel_to_send
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t DataLinkManager::route_frame(uint8_t dest_id, uint8_t* channel_to_send){
|
||||
RIPRow* entry = nullptr;
|
||||
|
||||
esp_err_t res;
|
||||
|
||||
res = rip_find_entry(dest_id, &entry, false);
|
||||
if (entry == nullptr){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (res != ESP_OK){
|
||||
return res;
|
||||
}
|
||||
|
||||
*channel_to_send = entry->channel;
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
[[noreturn]] void DataLinkManager::rip_broadcast_timer_function(void* args){
|
||||
DataLinkManager* link_layer_obj = static_cast<DataLinkManager*>(args);
|
||||
if (link_layer_obj == nullptr){
|
||||
if (link_layer_obj == nullptr || link_layer_obj->manual_broadcasts == nullptr){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "RIP Broadacst task failed to start due to invalid pointer");
|
||||
vTaskDelete(nullptr);
|
||||
}
|
||||
@@ -581,9 +683,10 @@ esp_err_t DataLinkManager::broadcast_rip_frame(){
|
||||
|
||||
esp_err_t res;
|
||||
while(true){
|
||||
vTaskDelay(pdMS_TO_TICKS(RIP_BROADCAST_INTERVAL)); //wait RIP_BROADCAST_INTERVAL ms
|
||||
bool dummy;
|
||||
xQueueReceive(link_layer_obj->manual_broadcasts, &dummy, pdMS_TO_TICKS(RIP_BROADCAST_INTERVAL)); //wait up to RIP_BROADCAST_INTERVAL ms
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Broadcasting table..."); //debug
|
||||
res = link_layer_obj->broadcast_rip_frame();
|
||||
res = link_layer_obj->broadcast_rip_frame(true);
|
||||
if (res != ESP_OK){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Failed to broadcast rip frame");
|
||||
}
|
||||
@@ -592,16 +695,16 @@ esp_err_t DataLinkManager::broadcast_rip_frame(){
|
||||
|
||||
[[noreturn]] void DataLinkManager::rip_ttl_decrement_task(void* args){
|
||||
DataLinkManager* link_layer_obj = static_cast<DataLinkManager*>(args);
|
||||
if (link_layer_obj == nullptr){
|
||||
if (link_layer_obj == nullptr || link_layer_obj->manual_broadcasts == nullptr){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "RIP Broadacst task failed to start due to invalid pointer");
|
||||
vTaskDelete(nullptr);
|
||||
}
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Starting RIP ttl decrement task");
|
||||
|
||||
bool broadcast = false;
|
||||
while(true){
|
||||
vTaskDelay(pdMS_TO_TICKS(RIP_MS_TO_SEC)); //run every second
|
||||
for (size_t i = 0; i < RIP_MAX_ROUTES; i++){
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Decrementing ttl on entry %d", i);
|
||||
// ESP_LOGI(DEBUG_LINK_TAG, "Decrementing ttl on entry %d", i);
|
||||
if (xSemaphoreTake(link_layer_obj->rip_table[i].row_sem, (TickType_t)RIP_MAX_SEM_WAIT) !=pdTRUE){
|
||||
ESP_LOGE(DEBUG_LINK_TAG, "Failed to get sem from entry %d", i);
|
||||
continue;
|
||||
@@ -610,14 +713,26 @@ esp_err_t DataLinkManager::broadcast_rip_frame(){
|
||||
xSemaphoreGive(link_layer_obj->rip_table[i].row_sem);
|
||||
continue;
|
||||
}
|
||||
if (link_layer_obj->rip_table[i].ttl == 0){
|
||||
link_layer_obj->rip_table[i].valid = RIP_INVALID_ROW;
|
||||
} else {
|
||||
if (link_layer_obj->rip_table[i].ttl != 0){
|
||||
// link_layer_obj->rip_table[i].valid = RIP_INVALID_ROW;
|
||||
// ESP_LOGI(DEBUG_LINK_TAG, "Entry %d now has ttl %d", i, link_layer_obj->rip_table[i].ttl);
|
||||
// } else {
|
||||
link_layer_obj->rip_table[i].ttl--;
|
||||
if (link_layer_obj->rip_table[i].ttl == 0){
|
||||
link_layer_obj->rip_table[i].info.hops = RIP_MAX_HOPS + 1;
|
||||
link_layer_obj->rip_table[i].ttl_flush = RIP_FLUSH_COUNT;
|
||||
broadcast = true;
|
||||
}
|
||||
}
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Entry %d now has ttl %d", i, link_layer_obj->rip_table[i].ttl);
|
||||
|
||||
xSemaphoreGive(link_layer_obj->rip_table[i].row_sem);
|
||||
}
|
||||
|
||||
if (broadcast && uxQueueMessagesWaiting(link_layer_obj->manual_broadcasts) == 0){
|
||||
broadcast = false;
|
||||
bool dummy = true;
|
||||
xQueueSend(link_layer_obj->manual_broadcasts, &dummy, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,8 +743,10 @@ esp_err_t DataLinkManager::broadcast_rip_frame(){
|
||||
* - start a task to periodically decrement the ttl values of each row in the RIP table (WIP) - this will require some sort of mutex on the table itself
|
||||
*/
|
||||
void DataLinkManager::start_rip_tasks(){
|
||||
manual_broadcasts = xQueueCreate(1, sizeof(bool));
|
||||
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Starting RIP Broadcast task");
|
||||
xTaskCreate(DataLinkManager::rip_broadcast_timer_function, "RIPBroadcastTask", 4096, static_cast<void*>(this), 5, NULL);
|
||||
xTaskCreate(DataLinkManager::rip_broadcast_timer_function, "RIPBroadcast", 2048, static_cast<void*>(this), 5, NULL);
|
||||
ESP_LOGI(DEBUG_LINK_TAG, "Starting RIP TTL task");
|
||||
xTaskCreate(DataLinkManager::rip_ttl_decrement_task, "RIPTTLTask", 4096, static_cast<void*>(this), 5, NULL);
|
||||
xTaskCreate(DataLinkManager::rip_ttl_decrement_task, "RIPTTL", 2048, static_cast<void*>(this), 5, NULL);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ static const uint16_t crc16_table[256] = {
|
||||
|
||||
class DataLinkManager{
|
||||
public:
|
||||
DataLinkManager(uint8_t board_id);
|
||||
DataLinkManager(uint8_t board_id, uint8_t num_channels);
|
||||
~DataLinkManager();
|
||||
esp_err_t send(uint8_t dest_board, uint8_t* data, uint16_t data_len, FrameType type, uint8_t curr_channel);
|
||||
esp_err_t start_receive_frames(uint8_t curr_channel);
|
||||
@@ -48,7 +48,8 @@ class DataLinkManager{
|
||||
esp_err_t send_discover_frame();
|
||||
private:
|
||||
uint8_t this_board_id = 0;
|
||||
std::priority_queue<Frame, std::vector<Frame>, FrameCompare> frame_queue; //create a priority queue
|
||||
uint8_t num_channels = MAX_CHANNELS;
|
||||
//std::priority_queue<Frame, std::vector<Frame>, FrameCompare> frame_queue; //create a priority queue - not in use
|
||||
std::unique_ptr<RMTManager> phys_comms;
|
||||
std::unordered_map<uint8_t, uint16_t> sequence_num_map;
|
||||
|
||||
@@ -56,7 +57,7 @@ class DataLinkManager{
|
||||
esp_err_t get_board_id(uint8_t& board_id);
|
||||
void print_binary(uint8_t byte);
|
||||
void print_buffer_binary(const uint8_t* buffer, size_t length);
|
||||
esp_err_t get_data_from_frame(uint8_t* data, size_t data_len, uint8_t* message, size_t* message_size);
|
||||
esp_err_t get_data_from_frame(uint8_t* data, size_t data_len, uint8_t* message, size_t* message_size, frame_header* header);
|
||||
esp_err_t geneate_crc_16(uint8_t* data, size_t data_len, uint16_t* crc);
|
||||
|
||||
//==== RIP related functions ====
|
||||
@@ -69,7 +70,7 @@ class DataLinkManager{
|
||||
*/
|
||||
|
||||
void init_rip();
|
||||
esp_err_t rip_find_entry(uint8_t board_id, RIPRow** entry);
|
||||
esp_err_t rip_find_entry(uint8_t board_id, RIPRow** entry, bool reserve_row);
|
||||
esp_err_t rip_update_entry(uint8_t new_hop, uint8_t channel, RIPRow** entry);
|
||||
esp_err_t rip_add_entry(uint8_t board_id, uint8_t hops, uint8_t channel, RIPRow** entry);
|
||||
esp_err_t rip_reset_entry_ttl(uint8_t board_id);
|
||||
@@ -78,12 +79,11 @@ class DataLinkManager{
|
||||
// std::unordered_map<uint8_t, RIPRow> rip_table; //using a hash map to store the routes to other boards - will be used as we scale up
|
||||
RIPRow rip_table[RIP_MAX_ROUTES]; //temp using a static array
|
||||
|
||||
uint8_t rip_table_valid_rows = 0;
|
||||
|
||||
void start_rip_tasks();
|
||||
esp_err_t broadcast_rip_frame();
|
||||
esp_err_t broadcast_rip_frame(bool manual_broadcast);
|
||||
[[noreturn]] static void rip_broadcast_timer_function(void* args);
|
||||
[[noreturn]] static void rip_ttl_decrement_task(void* args);
|
||||
QueueHandle_t manual_broadcasts;
|
||||
|
||||
esp_err_t route_frame(uint8_t dest_id, uint8_t* channel_to_send);
|
||||
};
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#define START_OF_FRAME 0xAB //0b1010_1011 - denotes the start of frame
|
||||
|
||||
#define MAX_GENERIC_DATA_LEN (180) //Max 180B
|
||||
#define MAX_CONTROL_DATA_LEN (1 << 5) // Max 32B
|
||||
#define MAX_GENERIC_DATA_LEN (1 << 16) //Max 65.5KiB
|
||||
#define MAX_CONTROL_DATA_LEN (1 << 8) // Max 256B
|
||||
|
||||
//Flags
|
||||
#define FLAG_FRAG 0x8 //0b1000 //this fragmented frame is part of a larger frame
|
||||
@@ -24,6 +24,7 @@
|
||||
#define IS_CONTROL_FRAME(x) (((x) & 0x80) != 0)
|
||||
|
||||
#define CONTROL_FRAME_OVERHEAD 9
|
||||
#define GENERIC_FRAME_OVERHEAD 12
|
||||
|
||||
#define CONTROL_FRAME_TYPE 0x80 //if the frame type MSB is set to 1, use the control frame
|
||||
//Types (total 2^4 = 16 different types)
|
||||
@@ -45,10 +46,10 @@ typedef struct _control_frame{
|
||||
uint8_t receiver_id; //receiver board id
|
||||
uint16_t seq_num; //sequence number to differentiate frames being sent from sender to receiver
|
||||
uint8_t type_flag; //(type << 4) | flag - both are 4 bits
|
||||
uint8_t data_len; //Data Length (max 32B)
|
||||
uint16_t data_len; //Data Length (max 256B)
|
||||
uint8_t data[MAX_CONTROL_DATA_LEN]; //Variable Length of Data
|
||||
uint16_t crc_16; //CRC-16
|
||||
} control_frame; //this will have a max size of 9 + 32B = 41B
|
||||
} control_frame; //this will have a max size of 9 + 256B = 265B
|
||||
|
||||
typedef struct _data_link_frame{
|
||||
uint8_t preamble; //Start of Frame
|
||||
@@ -60,39 +61,17 @@ typedef struct _data_link_frame{
|
||||
uint16_t data_len; //Data Length (max 178B)
|
||||
uint8_t data[MAX_GENERIC_DATA_LEN]; //Variable Length of Data
|
||||
uint16_t crc_16; //CRC-16
|
||||
} data_link_frame; //this will have a max size of 12 + 180 B = 192B
|
||||
} data_link_frame; //this will have a max size of ~65.5KiB
|
||||
#pragma pack(pop)
|
||||
|
||||
using Frame = std::variant<control_frame, data_link_frame>;
|
||||
|
||||
//defining a comparison operation for comparing two frames -- not tested
|
||||
struct FrameCompare {
|
||||
bool operator()(const Frame& a, const Frame& b) const {
|
||||
auto msb_set = [](uint8_t type_flag) {
|
||||
return (type_flag & 0x80) != 0; // 0x80 == 1000 0000
|
||||
};
|
||||
|
||||
auto get_type_flag = [](const Frame& pkt) -> uint8_t {
|
||||
return std::visit([](auto&& p) -> uint8_t {
|
||||
return p.type_flag;
|
||||
}, pkt);
|
||||
};
|
||||
|
||||
uint8_t type_flag_a = get_type_flag(a);
|
||||
uint8_t type_flag_b = get_type_flag(b);
|
||||
|
||||
bool a_msb = msb_set(type_flag_a);
|
||||
bool b_msb = msb_set(type_flag_b);
|
||||
|
||||
if (a_msb != b_msb) {
|
||||
return !a_msb; // Frame with MSB set (true) should come first
|
||||
}
|
||||
|
||||
// Tie-breaker: use seq_num if MSB is the same
|
||||
return std::visit([](auto&& p1, auto&& p2) {
|
||||
return p1.seq_num > p2.seq_num; // smaller seq_num = higher priority (older)
|
||||
}, a, b);
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct _header{
|
||||
uint8_t preamble; //Start of Frame
|
||||
uint8_t sender_id; //sender board id
|
||||
uint8_t receiver_id; //receiver board id
|
||||
uint16_t seq_num; //sequence number to differentiate frames being sent from sender to receiver
|
||||
uint8_t type_flag; //(type << 4) | flag - both are 4 bits
|
||||
uint16_t frag_info; //(total_frag_num << 8) | frag_num - total_frag_num denotes the total number of fragmented frames to expect for this sequence number(?) and frag_num denotes the fragment frame num
|
||||
uint16_t data_len; //Data Length (max 178B)
|
||||
uint16_t crc_16; //CRC-16
|
||||
} frame_header;
|
||||
#endif //DATA_LINK
|
||||
@@ -5,11 +5,14 @@
|
||||
#define RIP_MAX_HOPS 15 //16 or more is infinite
|
||||
#define RIP_MAX_ROUTES 10 //for the demo we will use up to 10 boards in total (9 other boards will be connected = 9 rows)
|
||||
#define RIP_INVALID_ROW 0
|
||||
// #define RIP_BROADCAST_INTERVAL 30000 //broadcast every 30 seconds (30000ms)
|
||||
#define RIP_BROADCAST_INTERVAL 3000 //temp broadcast every 3 seconds (3000ms)
|
||||
#define RIP_VALID_ROW 1
|
||||
#define RIP_NEW_ROW 2
|
||||
#define RIP_BROADCAST_INTERVAL 30000 //broadcast every 30 seconds (30000ms)
|
||||
// #define RIP_BROADCAST_INTERVAL 3000 //temp broadcast every 3 seconds (3000ms)
|
||||
#define RIP_TTL_START 180 //seconds
|
||||
#define RIP_MS_TO_SEC 1000 //1000 ms to 1 sec
|
||||
#define RIP_MAX_SEM_WAIT 30
|
||||
#define RIP_FLUSH_COUNT 8 //flush after 8*30 seconds = 240 seconds
|
||||
|
||||
/**
|
||||
* @brief Routing data to a board
|
||||
@@ -25,6 +28,7 @@ typedef struct _rip_row{
|
||||
uint8_t channel; //rmt channel
|
||||
uint8_t ttl; //how long this entry is valid for. starting value is 180 seconds
|
||||
uint8_t valid; //is this a valid entry?
|
||||
uint8_t ttl_flush; //if hops is invalid, this would count the amount of time until this entry would be invalid (in multiples of 30 seconds)
|
||||
StaticSemaphore_t mutex_buf; //where mutex state is stored
|
||||
SemaphoreHandle_t row_sem; //mutex sem handle of mutex_buf
|
||||
} RIPRow;
|
||||
|
||||
@@ -7,22 +7,31 @@
|
||||
#include "freertos/semphr.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
RMTManager::RMTManager(){
|
||||
/**
|
||||
* @brief Construct a new RMTManager::RMTManager object
|
||||
*
|
||||
* @param num_channels Number of channels to init (1-4) inclusive
|
||||
*/
|
||||
RMTManager::RMTManager(uint8_t num_channels = MAX_CHANNELS){
|
||||
if (num_channels > MAX_CHANNELS || num_channels == 0){
|
||||
ESP_LOGE(DEBUG_TAG, "Invalid number of channels to init");
|
||||
return;
|
||||
}
|
||||
this->num_channels = num_channels;
|
||||
esp_err_t res = init();
|
||||
if (res != ESP_OK){
|
||||
//failed
|
||||
ESP_LOGE(DEBUG_TAG, "Failed to initialize the RMTManager");
|
||||
return;
|
||||
}
|
||||
ESP_LOGD(DEBUG_TAG, "RMTManager has been initialized");
|
||||
ESP_LOGI(DEBUG_TAG, "RMTManager has been initialized");
|
||||
}
|
||||
|
||||
esp_err_t RMTManager::init_tx_channel(){
|
||||
esp_err_t res_tx = ESP_FAIL;
|
||||
|
||||
//setup encoder config
|
||||
|
||||
for (uint8_t i = 0; i < MAX_CHANNELS; i++){
|
||||
for (uint8_t i = 0; i < num_channels; i++){
|
||||
//setup encoder config
|
||||
reset_encoder_context(&channels[i].encoder_context); //ensure the encoder context is initialized
|
||||
rmt_simple_encoder_config_t encoder_config = {
|
||||
.callback = encoder_callback,
|
||||
@@ -118,7 +127,7 @@ esp_err_t RMTManager::init_tx_channel(){
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("Successfully enabled TX channel %d\n", i);
|
||||
ESP_LOGI(DEBUG_TAG, "Successfully enabled TX channel %d", i);
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
@@ -155,7 +164,7 @@ bool RMTManager::rmt_tx_done_callback(rmt_channel_handle_t channel, const rmt_tx
|
||||
}
|
||||
|
||||
esp_err_t RMTManager::wait_until_send_complete(uint8_t channel_num){
|
||||
if (channel_num >= MAX_CHANNELS){
|
||||
if (channel_num >= num_channels){
|
||||
ESP_LOGE(DEBUG_TAG, "Invalid channel number");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@@ -186,7 +195,7 @@ bool RMTManager::rmt_rx_done_callback(rmt_channel_handle_t channel, const rmt_rx
|
||||
}
|
||||
|
||||
esp_err_t RMTManager::init_rx_channel(){
|
||||
for (uint8_t i = 0; i < MAX_CHANNELS; i++){
|
||||
for (uint8_t i = 0; i < num_channels; i++){
|
||||
rmt_rx_channel_config_t rx_channel_config = {
|
||||
.gpio_num = rx_gpio[i],
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
@@ -229,6 +238,8 @@ esp_err_t RMTManager::init_rx_channel(){
|
||||
ESP_LOGE(DEBUG_TAG, "Failed to enable RX channel");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
ESP_LOGI(DEBUG_TAG, "Enabled RX Channel %d", i);
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
@@ -250,7 +261,7 @@ esp_err_t RMTManager::init(){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < MAX_CHANNELS; i++){
|
||||
for (uint8_t i = 0; i < num_channels; i++){
|
||||
if (channels[i].tx_rmt_handle != NULL && channels[i].rx_rmt_handle != NULL && channels[i].tx_done_semaphore != NULL && channels[i].rx_queue != NULL){
|
||||
channels[i].status = CHANNEL_READY_STATUS;
|
||||
}
|
||||
@@ -371,13 +382,15 @@ void RMTManager::reset_encoder_context(rmt_encoder_context_t* ctx){
|
||||
* @param config
|
||||
* @return int
|
||||
*/
|
||||
int RMTManager::send(uint8_t* data, size_t size, rmt_transmit_config_t* config, uint8_t channel_num){
|
||||
if (channel_num >= MAX_CHANNELS){
|
||||
esp_err_t RMTManager::send(uint8_t* data, size_t size, rmt_transmit_config_t* config, uint8_t channel_num){
|
||||
if (channel_num >= num_channels){
|
||||
ESP_LOGE(DEBUG_TAG, "send() error: invalid channel number");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (channels[channel_num].status == CHANNEL_NOT_READY_STATUS){
|
||||
ESP_LOGE(DEBUG_TAG, "send() error: Channel %d is not ready", channel_num);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (this->channels[channel_num].tx_rmt_handle == nullptr) {
|
||||
@@ -638,7 +651,7 @@ int RMTManager::convert_symbols_to_char(rmt_symbol_word_t* symbols, size_t num,
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t RMTManager::start_receiving(uint8_t channel_num){
|
||||
if (channel_num >= MAX_CHANNELS){
|
||||
if (channel_num >= num_channels){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@@ -673,8 +686,8 @@ esp_err_t RMTManager::start_receiving(uint8_t channel_num){
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int RMTManager::receive(uint8_t* recv_buf, size_t size, size_t* output_size, uint8_t channel_num){
|
||||
if (channel_num >= MAX_CHANNELS){
|
||||
esp_err_t RMTManager::receive(uint8_t* recv_buf, size_t size, size_t* output_size, uint8_t channel_num){
|
||||
if (channel_num >= num_channels){
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@@ -717,7 +730,7 @@ int RMTManager::receive(uint8_t* recv_buf, size_t size, size_t* output_size, uin
|
||||
}
|
||||
|
||||
RMTManager::~RMTManager(){
|
||||
for (uint8_t i = 0; i < MAX_CHANNELS; i++){
|
||||
for (uint8_t i = 0; i < num_channels; i++){
|
||||
if (this->channels[i].tx_rmt_handle) {
|
||||
rmt_disable(this->channels[i].tx_rmt_handle);
|
||||
rmt_del_channel(this->channels[i].tx_rmt_handle);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "driver/rmt_tx.h"
|
||||
#include "driver/rmt_rx.h"
|
||||
|
||||
#include "soc/gpio_num.h"
|
||||
#include "RMTSymbols.h"
|
||||
|
||||
#include <cstring>
|
||||
@@ -61,10 +62,10 @@ typedef struct _rmt_channel{
|
||||
|
||||
class RMTManager{
|
||||
public:
|
||||
RMTManager();
|
||||
RMTManager(uint8_t num_channels);
|
||||
~RMTManager();
|
||||
int send(uint8_t* data, size_t size, rmt_transmit_config_t* config, uint8_t channel_num); //temp function to send some string data
|
||||
int receive(uint8_t* recv_buf, size_t size, size_t* output_size, uint8_t channel_num);
|
||||
esp_err_t send(uint8_t* data, size_t size, rmt_transmit_config_t* config, uint8_t channel_num); //temp function to send some string data
|
||||
esp_err_t receive(uint8_t* recv_buf, size_t size, size_t* output_size, uint8_t channel_num);
|
||||
|
||||
static size_t encoder_callback(const void* data, size_t data_size, size_t symbols_written,
|
||||
size_t symbols_free, rmt_symbol_word_t* symbols, bool* done, void* arg);
|
||||
@@ -77,6 +78,7 @@ class RMTManager{
|
||||
esp_err_t wait_until_send_complete(uint8_t channel_num);
|
||||
|
||||
private:
|
||||
uint8_t num_channels; //number of channels initalized
|
||||
esp_err_t init();
|
||||
void reset_encoder_context(rmt_encoder_context_t* ctx);
|
||||
esp_err_t init_tx_channel();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
idf_component_register(SRCS "main.cpp" "LoopManager.cpp"
|
||||
PRIV_REQUIRES esp_psram spi_flash nvs_flash esp_event rpc constants config rmt esp_driver_gptimer dataLink flatbuffers
|
||||
idf_component_register(SRCS "main.cpp" "LoopManager.cpp"
|
||||
PRIV_REQUIRES esp_psram spi_flash nvs_flash esp_event rpc constants config rmt esp_driver_gptimer dataLink
|
||||
INCLUDE_DIRS "")
|
||||
|
||||
if(DEFINED BOARD_NAME AND BOARD_NAME)
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "driver/gptimer.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#define DATA_SIZE_TEST 270
|
||||
|
||||
struct TaskArgs{
|
||||
DataLinkManager* link_layer_obj;
|
||||
uint8_t task_id;
|
||||
@@ -46,8 +48,8 @@ void receive_frames(void* arg){
|
||||
printf("RX JOB for task %d starting...\n", curr_channel);
|
||||
esp_err_t res;
|
||||
|
||||
uint8_t recv_buf[256];
|
||||
memset(recv_buf, 0, 256);
|
||||
uint8_t recv_buf[DATA_SIZE_TEST];
|
||||
memset(recv_buf, 0, DATA_SIZE_TEST);
|
||||
size_t recv_len = 0;
|
||||
|
||||
ReceviedFrame recv_frame = {};
|
||||
@@ -101,10 +103,10 @@ void multi_transceiver(void* arg) {
|
||||
QueueHandle_t shared_queue = (QueueHandle_t)args->receive_queue;
|
||||
|
||||
|
||||
uint8_t send_buf[256];
|
||||
uint8_t recv_buf[256];
|
||||
memset(recv_buf, 0, 256);
|
||||
memset(send_buf, 0, 256);
|
||||
uint8_t send_buf[DATA_SIZE_TEST];
|
||||
uint8_t recv_buf[DATA_SIZE_TEST];
|
||||
memset(recv_buf, 0, DATA_SIZE_TEST);
|
||||
memset(send_buf, 0, DATA_SIZE_TEST);
|
||||
|
||||
size_t recv_len = 0;
|
||||
uint8_t iteration = 0;
|
||||
@@ -126,24 +128,25 @@ void multi_transceiver(void* arg) {
|
||||
|
||||
ReceviedFrame recv_frame = {};
|
||||
printf("task %d starting...\n", curr_channel);
|
||||
vTaskDelay(3000 / portTICK_PERIOD_MS);
|
||||
|
||||
while(true){
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS); // wait 1 second before trying to send again
|
||||
while(1){
|
||||
// vTaskDelay(1000 / portTICK_PERIOD_MS); // wait 1 second before trying to send again
|
||||
|
||||
snprintf(reinterpret_cast<char*>(send_buf), sizeof(send_buf), "%s %d CH. %d", message, iteration, curr_channel);
|
||||
// snprintf(reinterpret_cast<char*>(send_buf), sizeof(send_buf), "%s %d CH. %d", message, iteration, curr_channel);
|
||||
|
||||
ESP_ERROR_CHECK(gptimer_get_raw_count(gptimer, &start_count));
|
||||
res = obj->send(dest_board_id, send_buf, strlen(reinterpret_cast<char*>(send_buf)), FrameType::DEBUG_CONTROL_TYPE, curr_channel);
|
||||
ESP_ERROR_CHECK(gptimer_get_raw_count(gptimer, &end_count));
|
||||
// ESP_ERROR_CHECK(gptimer_get_raw_count(gptimer, &start_count));
|
||||
// res = obj->send(dest_board_id, send_buf, strlen(reinterpret_cast<char*>(send_buf)), FrameType::DEBUG_CONTROL_TYPE, curr_channel);
|
||||
// ESP_ERROR_CHECK(gptimer_get_raw_count(gptimer, &end_count));
|
||||
|
||||
snprintf(reinterpret_cast<char*>(send_buf), sizeof(send_buf), "%s RANDOM", message); //modifying the data while it transmits shouldn't affect the actual transmission here
|
||||
// snprintf(reinterpret_cast<char*>(send_buf), sizeof(send_buf), "%s RANDOM", message); //modifying the data while it transmits shouldn't affect the actual transmission here
|
||||
|
||||
if (res != ESP_OK){
|
||||
ESP_LOGE("thread", "Failed to send message on thread %d", curr_channel);
|
||||
} else {
|
||||
printf("Successfully sent message\n");
|
||||
// printf("Sent %zu B sized in %" PRIu64 " us\n", strlen(reinterpret_cast<char*>(send_buf)) + CONTROL_FRAME_OVERHEAD, end_count-start_count);
|
||||
}
|
||||
// if (res != ESP_OK){
|
||||
// ESP_LOGE("thread", "Failed to send message on thread %d", curr_channel);
|
||||
// } else {
|
||||
// printf("Successfully sent message\n");
|
||||
// // printf("Sent %zu B sized in %" PRIu64 " us\n", strlen(reinterpret_cast<char*>(send_buf)) + CONTROL_FRAME_OVERHEAD, end_count-start_count);
|
||||
// }
|
||||
|
||||
//wait on a queue for a few ms (if there's nothing, just send another frame. otherwise pop from queue and read it)
|
||||
if (xQueueReceive(shared_queue, (void*)&recv_frame, (TickType_t) 50) != pdPASS){
|
||||
@@ -169,8 +172,12 @@ void multi_transceiver(void* arg) {
|
||||
|
||||
// vTaskDelay(1000 / portTICK_PERIOD_MS); // wait 1 second before trying to send again
|
||||
//reset temp buffers
|
||||
memset(recv_buf, 0, 256);
|
||||
memset(send_buf, 0, 256);
|
||||
memset(recv_buf, 0, DATA_SIZE_TEST);
|
||||
memset(send_buf, 0, DATA_SIZE_TEST);
|
||||
}
|
||||
|
||||
while(true){
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -207,9 +214,9 @@ extern "C" [[noreturn]] void app_main(void) {
|
||||
|
||||
// uint8_t iteration = 0;
|
||||
// const char* message = "THIS IS A TEXT MESSAGE";
|
||||
|
||||
uint8_t num_channels = 1;
|
||||
uint8_t board_id = 69;
|
||||
std::unique_ptr<DataLinkManager> obj = std::make_unique<DataLinkManager>(board_id);
|
||||
std::unique_ptr<DataLinkManager> obj = std::make_unique<DataLinkManager>(board_id, num_channels);
|
||||
|
||||
// uint8_t dest_board_id = 2; //using a dummy number for now - there is no board with id 2 right now
|
||||
|
||||
@@ -225,10 +232,10 @@ extern "C" [[noreturn]] void app_main(void) {
|
||||
|
||||
TaskArgs args[4] = {};
|
||||
|
||||
for (uint8_t i = 0; i < MAX_CHANNELS; i++){
|
||||
for (uint8_t i = 0; i < num_channels; i++){
|
||||
args[i].link_layer_obj = obj_to_send;
|
||||
args[i].task_id = i;
|
||||
args[i].receiver_id = i+1;
|
||||
args[i].receiver_id = 1;
|
||||
args[i].receive_queue = xQueueCreate(10, sizeof(ReceviedFrame)); //queue storing up to 10 control frames
|
||||
xTaskCreate(multi_transceiver, "multi_transceiver", 4096, static_cast<void*>(&args[i]), 5, NULL);
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
|
||||
141
sdkconfig
141
sdkconfig
@@ -95,7 +95,6 @@ CONFIG_SOC_APB_BACKUP_DMA=y
|
||||
CONFIG_SOC_BROWNOUT_RESET_SUPPORTED=y
|
||||
CONFIG_SOC_CACHE_WRITEBACK_SUPPORTED=y
|
||||
CONFIG_SOC_CACHE_FREEZE_SUPPORTED=y
|
||||
CONFIG_SOC_CACHE_ACS_INVALID_STATE_ON_PANIC=y
|
||||
CONFIG_SOC_CPU_CORES_NUM=2
|
||||
CONFIG_SOC_CPU_INTR_NUM=32
|
||||
CONFIG_SOC_CPU_HAS_FPU=y
|
||||
@@ -147,10 +146,8 @@ CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y
|
||||
CONFIG_SOC_I2S_SUPPORTS_PCM=y
|
||||
CONFIG_SOC_I2S_SUPPORTS_PDM=y
|
||||
CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y
|
||||
CONFIG_SOC_I2S_SUPPORTS_PCM2PDM=y
|
||||
CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y
|
||||
CONFIG_SOC_I2S_SUPPORTS_PDM2PCM=y
|
||||
CONFIG_SOC_I2S_PDM_MAX_TX_LINES=2
|
||||
CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y
|
||||
CONFIG_SOC_I2S_PDM_MAX_RX_LINES=4
|
||||
CONFIG_SOC_I2S_SUPPORTS_TDM=y
|
||||
CONFIG_SOC_LEDC_SUPPORT_APB_CLOCK=y
|
||||
@@ -172,8 +169,6 @@ CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3
|
||||
CONFIG_SOC_MCPWM_SWSYNC_CAN_PROPAGATE=y
|
||||
CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=1
|
||||
CONFIG_SOC_MMU_PERIPH_NUM=1
|
||||
CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000
|
||||
CONFIG_SOC_MPU_REGIONS_MAX_NUM=8
|
||||
CONFIG_SOC_PCNT_GROUPS=1
|
||||
CONFIG_SOC_PCNT_UNITS_PER_GROUP=4
|
||||
CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2
|
||||
@@ -234,7 +229,7 @@ CONFIG_SOC_SPI_SCT_SUPPORTED=y
|
||||
CONFIG_SOC_SPI_SCT_REG_NUM=14
|
||||
CONFIG_SOC_SPI_SCT_BUFFER_NUM_MAX=y
|
||||
CONFIG_SOC_SPI_SCT_CONF_BITLEN_MAX=0x3FFFA
|
||||
CONFIG_SOC_MEMSPI_SRC_FREQ_120M_SUPPORTED=y
|
||||
CONFIG_SOC_MEMSPI_SRC_FREQ_120M=y
|
||||
CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y
|
||||
CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y
|
||||
CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y
|
||||
@@ -263,7 +258,6 @@ CONFIG_SOC_TOUCH_SUPPORT_BENCHMARK=y
|
||||
CONFIG_SOC_TOUCH_SUPPORT_SLEEP_WAKEUP=y
|
||||
CONFIG_SOC_TOUCH_SUPPORT_WATERPROOF=y
|
||||
CONFIG_SOC_TOUCH_SUPPORT_PROX_SENSING=y
|
||||
CONFIG_SOC_TOUCH_SUPPORT_DENOISE_CHAN=y
|
||||
CONFIG_SOC_TOUCH_PROXIMITY_CHANNEL_NUM=3
|
||||
CONFIG_SOC_TOUCH_PROXIMITY_MEAS_DONE_SUPPORTED=y
|
||||
CONFIG_SOC_TOUCH_SAMPLE_CFG_NUM=1
|
||||
@@ -326,7 +320,6 @@ CONFIG_SOC_CLK_RC_FAST_D256_SUPPORTED=y
|
||||
CONFIG_SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256=y
|
||||
CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y
|
||||
CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y
|
||||
CONFIG_SOC_CLK_LP_FAST_SUPPORT_XTAL_D2=y
|
||||
CONFIG_SOC_EFUSE_DIS_DOWNLOAD_ICACHE=y
|
||||
CONFIG_SOC_EFUSE_DIS_DOWNLOAD_DCACHE=y
|
||||
CONFIG_SOC_EFUSE_HARD_DIS_JTAG=y
|
||||
@@ -353,7 +346,7 @@ CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE=y
|
||||
CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND=y
|
||||
CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_RESUME=y
|
||||
CONFIG_SOC_SPI_MEM_SUPPORT_SW_SUSPEND=y
|
||||
CONFIG_SOC_SPI_MEM_SUPPORT_FLASH_OPI_MODE=y
|
||||
CONFIG_SOC_SPI_MEM_SUPPORT_OPI_MODE=y
|
||||
CONFIG_SOC_SPI_MEM_SUPPORT_TIMING_TUNING=y
|
||||
CONFIG_SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE=y
|
||||
CONFIG_SOC_SPI_MEM_SUPPORT_WRAP=y
|
||||
@@ -439,8 +432,6 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||
#
|
||||
# Log
|
||||
#
|
||||
CONFIG_BOOTLOADER_LOG_VERSION_1=y
|
||||
CONFIG_BOOTLOADER_LOG_VERSION=1
|
||||
# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
|
||||
# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
|
||||
# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set
|
||||
@@ -478,6 +469,7 @@ CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y
|
||||
CONFIG_BOOTLOADER_WDT_ENABLE=y
|
||||
# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set
|
||||
CONFIG_BOOTLOADER_WDT_TIME_MS=9000
|
||||
# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set
|
||||
# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set
|
||||
# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set
|
||||
# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set
|
||||
@@ -521,7 +513,6 @@ CONFIG_ESP_ROM_HAS_HAL_WDT=y
|
||||
CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y
|
||||
CONFIG_ESP_ROM_HAS_LAYOUT_TABLE=y
|
||||
CONFIG_ESP_ROM_HAS_SPI_FLASH=y
|
||||
CONFIG_ESP_ROM_HAS_SPI_FLASH_MMAP=y
|
||||
CONFIG_ESP_ROM_HAS_ETS_PRINTF_BUG=y
|
||||
CONFIG_ESP_ROM_HAS_NEWLIB=y
|
||||
CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y
|
||||
@@ -535,7 +526,6 @@ CONFIG_ESP_ROM_HAS_SW_FLOAT=y
|
||||
CONFIG_ESP_ROM_HAS_VERSION=y
|
||||
CONFIG_ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB=y
|
||||
CONFIG_ESP_ROM_HAS_OUTPUT_PUTC_FUNC=y
|
||||
CONFIG_ESP_ROM_CONSOLE_OUTPUT_SECONDARY=y
|
||||
|
||||
#
|
||||
# Boot ROM Behavior
|
||||
@@ -727,8 +717,7 @@ CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
|
||||
#
|
||||
CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y
|
||||
# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set
|
||||
# CONFIG_GPTIMER_ISR_CACHE_SAFE is not set
|
||||
CONFIG_GPTIMER_OBJ_CACHE_SAFE=y
|
||||
# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set
|
||||
# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set
|
||||
# end of ESP-Driver:GPTimer Configurations
|
||||
|
||||
@@ -774,15 +763,9 @@ CONFIG_MCPWM_OBJ_CACHE_SAFE=y
|
||||
#
|
||||
# ESP-Driver:RMT Configurations
|
||||
#
|
||||
CONFIG_RMT_ENCODER_FUNC_IN_IRAM=y
|
||||
CONFIG_RMT_TX_ISR_HANDLER_IN_IRAM=y
|
||||
CONFIG_RMT_RX_ISR_HANDLER_IN_IRAM=y
|
||||
# CONFIG_RMT_RECV_FUNC_IN_IRAM is not set
|
||||
# CONFIG_RMT_TX_ISR_CACHE_SAFE is not set
|
||||
# CONFIG_RMT_RX_ISR_CACHE_SAFE is not set
|
||||
CONFIG_RMT_OBJ_CACHE_SAFE=y
|
||||
# CONFIG_RMT_ENABLE_DEBUG_LOG is not set
|
||||
# CONFIG_RMT_ISR_IRAM_SAFE is not set
|
||||
# CONFIG_RMT_RECV_FUNC_IN_IRAM is not set
|
||||
# CONFIG_RMT_ENABLE_DEBUG_LOG is not set
|
||||
# end of ESP-Driver:RMT Configurations
|
||||
|
||||
#
|
||||
@@ -917,8 +900,7 @@ CONFIG_RTC_CLK_CAL_CYCLES=1024
|
||||
#
|
||||
# Peripheral Control
|
||||
#
|
||||
CONFIG_ESP_PERIPH_CTRL_FUNC_IN_IRAM=y
|
||||
CONFIG_ESP_REGI2C_CTRL_FUNC_IN_IRAM=y
|
||||
CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y
|
||||
# end of Peripheral Control
|
||||
|
||||
#
|
||||
@@ -937,28 +919,7 @@ CONFIG_XTAL_FREQ_40=y
|
||||
CONFIG_XTAL_FREQ=40
|
||||
# end of Main XTAL Config
|
||||
|
||||
#
|
||||
# Power Supplier
|
||||
#
|
||||
|
||||
#
|
||||
# Brownout Detector
|
||||
#
|
||||
CONFIG_ESP_BROWNOUT_DET=y
|
||||
CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7=y
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1 is not set
|
||||
CONFIG_ESP_BROWNOUT_DET_LVL=7
|
||||
CONFIG_ESP_BROWNOUT_USE_INTR=y
|
||||
# end of Brownout Detector
|
||||
# end of Power Supplier
|
||||
|
||||
CONFIG_ESP_SPI_BUS_LOCK_ISR_FUNCS_IN_IRAM=y
|
||||
CONFIG_ESP_INTR_IN_IRAM=y
|
||||
# end of Hardware Settings
|
||||
|
||||
#
|
||||
@@ -1010,7 +971,6 @@ CONFIG_ESP_PHY_IRAM_OPT=y
|
||||
#
|
||||
# Power Management
|
||||
#
|
||||
CONFIG_PM_SLEEP_FUNC_IN_IRAM=y
|
||||
# CONFIG_PM_ENABLE is not set
|
||||
CONFIG_PM_SLP_IRAM_OPT=y
|
||||
CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
|
||||
@@ -1168,6 +1128,22 @@ CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
|
||||
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
|
||||
CONFIG_ESP_DEBUG_OCDAWARE=y
|
||||
CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y
|
||||
|
||||
#
|
||||
# Brownout Detector
|
||||
#
|
||||
CONFIG_ESP_BROWNOUT_DET=y
|
||||
CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7=y
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set
|
||||
# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1 is not set
|
||||
CONFIG_ESP_BROWNOUT_DET_LVL=7
|
||||
# end of Brownout Detector
|
||||
|
||||
CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y
|
||||
CONFIG_ESP_SYSTEM_BBPLL_RECALIB=y
|
||||
# end of ESP System Settings
|
||||
|
||||
@@ -1183,7 +1159,6 @@ CONFIG_ESP_IPC_ISR_ENABLE=y
|
||||
#
|
||||
# ESP Timer (High Resolution Timer)
|
||||
#
|
||||
CONFIG_ESP_TIMER_IN_IRAM=y
|
||||
# CONFIG_ESP_TIMER_PROFILING is not set
|
||||
CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y
|
||||
CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y
|
||||
@@ -1226,12 +1201,10 @@ CONFIG_ESP_WIFI_IRAM_OPT=y
|
||||
CONFIG_ESP_WIFI_RX_IRAM_OPT=y
|
||||
CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y
|
||||
CONFIG_ESP_WIFI_ENABLE_SAE_PK=y
|
||||
CONFIG_ESP_WIFI_ENABLE_SAE_H2E=y
|
||||
CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y
|
||||
CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y
|
||||
# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set
|
||||
CONFIG_ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME=50
|
||||
# CONFIG_ESP_WIFI_BSS_MAX_IDLE_SUPPORT is not set
|
||||
CONFIG_ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME=10
|
||||
CONFIG_ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME=15
|
||||
# CONFIG_ESP_WIFI_FTM_ENABLE is not set
|
||||
@@ -1333,7 +1306,6 @@ CONFIG_FREERTOS_DEBUG_OCDAWARE=y
|
||||
CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y
|
||||
CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y
|
||||
CONFIG_FREERTOS_NUMBER_OF_CORES=2
|
||||
CONFIG_FREERTOS_IN_IRAM=y
|
||||
# end of FreeRTOS
|
||||
|
||||
#
|
||||
@@ -1366,9 +1338,6 @@ CONFIG_HEAP_TRACING_OFF=y
|
||||
#
|
||||
# Log
|
||||
#
|
||||
CONFIG_LOG_VERSION_1=y
|
||||
# CONFIG_LOG_VERSION_2 is not set
|
||||
CONFIG_LOG_VERSION=1
|
||||
|
||||
#
|
||||
# Log Level
|
||||
@@ -1422,6 +1391,7 @@ CONFIG_LOG_IN_IRAM=y
|
||||
#
|
||||
CONFIG_LWIP_ENABLE=y
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
|
||||
# CONFIG_LWIP_NETIF_API is not set
|
||||
CONFIG_LWIP_TCPIP_TASK_PRIO=18
|
||||
# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set
|
||||
# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set
|
||||
@@ -1569,7 +1539,6 @@ CONFIG_LWIP_DNS_MAX_HOST_IP=1
|
||||
CONFIG_LWIP_DNS_MAX_SERVERS=3
|
||||
# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set
|
||||
# CONFIG_LWIP_DNS_SETSERVER_WITH_NETIF is not set
|
||||
# CONFIG_LWIP_USE_ESP_GETADDRINFO is not set
|
||||
# end of DNS
|
||||
|
||||
CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7
|
||||
@@ -1590,9 +1559,6 @@ CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y
|
||||
CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y
|
||||
# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set
|
||||
# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set
|
||||
CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_NONE=y
|
||||
# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_DEFAULT is not set
|
||||
# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_CUSTOM is not set
|
||||
CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y
|
||||
# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set
|
||||
# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set
|
||||
@@ -1661,7 +1627,6 @@ CONFIG_MBEDTLS_HAVE_TIME=y
|
||||
# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set
|
||||
# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set
|
||||
CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y
|
||||
CONFIG_MBEDTLS_SHA1_C=y
|
||||
CONFIG_MBEDTLS_SHA512_C=y
|
||||
# CONFIG_MBEDTLS_SHA3_C is not set
|
||||
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
|
||||
@@ -1743,11 +1708,10 @@ CONFIG_MBEDTLS_ECP_NIST_OPTIM=y
|
||||
# CONFIG_MBEDTLS_THREADING_C is not set
|
||||
CONFIG_MBEDTLS_ERROR_STRINGS=y
|
||||
CONFIG_MBEDTLS_FS_IO=y
|
||||
# CONFIG_MBEDTLS_ALLOW_WEAK_CERTIFICATE_VERIFICATION is not set
|
||||
# end of mbedTLS
|
||||
|
||||
#
|
||||
# LibC
|
||||
# Newlib
|
||||
#
|
||||
CONFIG_LIBC_NEWLIB=y
|
||||
CONFIG_LIBC_MISC_IN_IRAM=y
|
||||
@@ -1824,8 +1788,6 @@ CONFIG_SPI_FLASH_HPM_DC_AUTO=y
|
||||
# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set
|
||||
CONFIG_SPI_FLASH_SUSPEND_TSUS_VAL_US=50
|
||||
# CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND is not set
|
||||
# CONFIG_SPI_FLASH_FORCE_ENABLE_C6_H2_SUSPEND is not set
|
||||
CONFIG_SPI_FLASH_PLACE_FUNCTIONS_IN_IRAM=y
|
||||
# end of Optional and Experimental Features (READ DOCS FIRST)
|
||||
# end of Main Flash configuration
|
||||
|
||||
@@ -1936,7 +1898,6 @@ CONFIG_MDNS_PREDEF_NETIF_AP=y
|
||||
# Deprecated options for backward compatibility
|
||||
# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set
|
||||
# CONFIG_NO_BLOBS is not set
|
||||
# CONFIG_APP_ROLLBACK_ENABLE is not set
|
||||
# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set
|
||||
# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set
|
||||
# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set
|
||||
@@ -1944,6 +1905,7 @@ CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y
|
||||
# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set
|
||||
# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set
|
||||
CONFIG_LOG_BOOTLOADER_LEVEL=3
|
||||
# CONFIG_APP_ROLLBACK_ENABLE is not set
|
||||
# CONFIG_FLASH_ENCRYPTION_ENABLED is not set
|
||||
# CONFIG_FLASHMODE_QIO is not set
|
||||
# CONFIG_FLASHMODE_QOUT is not set
|
||||
@@ -1979,26 +1941,6 @@ CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC=y
|
||||
# CONFIG_ESP32S3_RTC_CLK_SRC_EXT_OSC is not set
|
||||
# CONFIG_ESP32S3_RTC_CLK_SRC_INT_8MD256 is not set
|
||||
CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=1024
|
||||
CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y
|
||||
CONFIG_BROWNOUT_DET=y
|
||||
CONFIG_ESP32S3_BROWNOUT_DET=y
|
||||
CONFIG_BROWNOUT_DET_LVL_SEL_7=y
|
||||
CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_7=y
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_6 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_5 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_4 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_3 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_2 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_1 is not set
|
||||
CONFIG_BROWNOUT_DET_LVL=7
|
||||
CONFIG_ESP32S3_BROWNOUT_DET_LVL=7
|
||||
CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y
|
||||
CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
||||
# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set
|
||||
CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20
|
||||
@@ -2035,6 +1977,24 @@ CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
|
||||
# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set
|
||||
CONFIG_ESP32S3_DEBUG_OCDAWARE=y
|
||||
CONFIG_BROWNOUT_DET=y
|
||||
CONFIG_ESP32S3_BROWNOUT_DET=y
|
||||
CONFIG_BROWNOUT_DET_LVL_SEL_7=y
|
||||
CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_7=y
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_6 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_5 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_4 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_3 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_2 is not set
|
||||
# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set
|
||||
# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_1 is not set
|
||||
CONFIG_BROWNOUT_DET_LVL=7
|
||||
CONFIG_ESP32S3_BROWNOUT_DET_LVL=7
|
||||
CONFIG_IPC_TASK_STACK_SIZE=1280
|
||||
CONFIG_TIMER_TASK_STACK_SIZE=3584
|
||||
CONFIG_ESP32_WIFI_ENABLED=y
|
||||
@@ -2098,22 +2058,11 @@ CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
|
||||
# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set
|
||||
CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF
|
||||
# CONFIG_PPP_SUPPORT is not set
|
||||
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y
|
||||
# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set
|
||||
# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set
|
||||
# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set
|
||||
# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set
|
||||
CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y
|
||||
# CONFIG_NEWLIB_NANO_FORMAT is not set
|
||||
CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_SYSTIMER=y
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_FRC1=y
|
||||
# CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC is not set
|
||||
# CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC is not set
|
||||
# CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT is not set
|
||||
# CONFIG_ESP32S3_TIME_SYSCALL_USE_SYSTIMER is not set
|
||||
# CONFIG_ESP32S3_TIME_SYSCALL_USE_FRC1 is not set
|
||||
# CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE is not set
|
||||
# CONFIG_ESP32S3_TIME_SYSCALL_USE_NONE is not set
|
||||
CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5
|
||||
CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
|
||||
|
||||
Reference in New Issue
Block a user