Skip to content

Commit

Permalink
updating cc3100 driver logic
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoLlobet committed Jan 15, 2024
1 parent ac3b1a5 commit 33d5e2c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
11 changes: 7 additions & 4 deletions csrc/board/src/board_CC3100.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,14 @@ int CC3100_IfRead(Fd_t Fd, uint8_t *pBuff, int Len)
ecode = SPIDRV_MReceive(&cc3100_usart, pBuff, Len, recieve_callback);
if (ECODE_EMDRV_SPIDRV_OK == ecode)
{
(void) xQueueReceive(rx_semaphore, &transfer_status, portMAX_DELAY);
if (ECODE_EMDRV_SPIDRV_OK == transfer_status.transferStatus)
if(pdTRUE == xQueueReceive(rx_semaphore, &transfer_status, 2*1000)) // Added rx timeout
{
retVal = transfer_status.itemsTransferred;
} else
if (ECODE_EMDRV_SPIDRV_OK == transfer_status.transferStatus)
{
retVal = transfer_status.itemsTransferred;
}
}
else
{
retVal = -1;
}
Expand Down
2 changes: 1 addition & 1 deletion csrc/config/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ extern "C" {
#define configCPU_CLOCK_HZ (( unsigned long )48000000 )
#define configMAX_PRIORITIES ( 7 )
#define configMINIMAL_STACK_SIZE (( unsigned short ) 160)
#define configTOTAL_HEAP_SIZE (( size_t )(61 * 1024 ))
#define configTOTAL_HEAP_SIZE (( size_t )(59 * 1024 ))
#define configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY ( 0 )
#define configUSE_16_BIT_TICKS ( 0 )
Expand Down
18 changes: 9 additions & 9 deletions csrc/src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static void select_task(void *param)
fd_set write_fd_set;
uint32_t notification_counter = 0;

struct timeout_msg_s timeout_msg;
struct timeout_msg_s timeout_msg = {0};
BaseType_t ret = pdFALSE;

while (1)
Expand Down Expand Up @@ -303,14 +303,14 @@ static void select_task(void *param)
{
// Start second cycle
// The select function is called with a timeout of 20 ms
const struct timeval tv =
{.tv_sec = 0, .tv_usec = 20000}; // Here we have the select cycle time
struct timeval tv = {.tv_sec = 0, .tv_usec = 50000}; // Here we have the select cycle time
int result = 0;

(void)xSemaphoreTake(rx_tx_mutex, portMAX_DELAY);

int result = sl_Select(FD_SETSIZE, read_set_ptr, write_fd_set_ptr, NULL, (struct SlTimeval_t *)&tv);

(void)xSemaphoreGive(rx_tx_mutex);
if(pdTRUE == xSemaphoreTake(rx_tx_mutex, portMAX_DELAY))
{
result = sl_Select(FD_SETSIZE, read_set_ptr, write_fd_set_ptr, NULL, (struct SlTimeval_t *)&tv);
(void)xSemaphoreGive(rx_tx_mutex);
}

if (result > 0)
{
Expand Down Expand Up @@ -350,7 +350,7 @@ static void select_task(void *param)
}
else
{
// printf("select %d\r\n", uxTaskGetStackHighWaterMark(network_monitor_task_handle));
// printf("select %d\r\n", uxTaskGetStackHighWaterMark(network_monitor_task_handle));

// Wait for notifications
(void)xTaskGenericNotifyWait(0, 0, UINT32_MAX, &notification_counter, portMAX_DELAY);
Expand Down
2 changes: 1 addition & 1 deletion src/config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub const rtos_stack_depth_lwm2m: u16 = if (enable_lwm2m) 2000 else min_task_sta

// MQTT
pub const rtos_prio_mqtt = @intFromEnum(task_priorities.rtos_prio_normal);
pub const rtos_stack_depth_mqtt: u16 = if (enable_mqtt) 1400 else min_task_stack_depth;
pub const rtos_stack_depth_mqtt: u16 = if (enable_mqtt) 1450 else min_task_stack_depth;

// HTTP
pub const rtos_prio_http = @intFromEnum(task_priorities.rtos_prio_normal);
Expand Down

0 comments on commit 33d5e2c

Please sign in to comment.