ST7789 并口驱动初始化卡死

Moderator: ESP_Bob

tongcc
Posts: 1
Joined: Mon Feb 28, 2022 3:59 pm

ST7789 并口驱动初始化卡死

Postby tongcc » Mon Feb 28, 2022 4:08 pm

在初始化ST7789并口驱动时,一直卡死了在了队列接收中:ESP_LOGI("i2s_write_data","xQueueReceive start1") 和ESP_LOGI("i2s_write_data","xQueueReceive end1")之间的 xQueueReceive(i2s_lcd_obj->event_queue, (void *)&event, portMAX_DELAY)中
代码如下:
static void i2s_write_data(i2s_lcd_obj_t *i2s_lcd_obj, uint8_t *data, size_t len)
{
int event = 0;
int x = 0, y = 0, left = 0, cnt = 0;
if (len <= 0) {
ESP_LOGE(TAG, "wrong len!");
return;
}
lcd_dma_set_int(i2s_lcd_obj);
uint32_t half_buffer_size = i2s_lcd_obj->dma_half_buffer_size;
cnt = len / half_buffer_size;
// Start signal
xQueueSend(i2s_lcd_obj->event_queue, &event, 0);
// Process a complete piece of data, ping-pong operation
for (x = 0; x < cnt; x++) {
uint8_t *out = (uint8_t*)i2s_lcd_obj->dma[(x % 2) * i2s_lcd_obj->dma_half_node_cnt].buf;
uint8_t *in = data;
if (i2s_lcd_obj->swap_data) {
uint8_t *out1 = out + 1;
uint8_t *in1 = in + 1;
for (y = 0; y < half_buffer_size;) {
out1[y] = in[y];
out[y] = in1[y];
y += 2;
out1[y] = in[y];
out[y] = in1[y];
y += 2;
}
} else {
memcpy(out, in, half_buffer_size);
}
data += half_buffer_size;
xQueueReceive(i2s_lcd_obj->event_queue, (void *)&event, portMAX_DELAY);
lcd_i2s_start(i2s_lcd_obj->i2s_dev, ((uint32_t)&i2s_lcd_obj->dma[(x % 2) * i2s_lcd_obj->dma_half_node_cnt]) & 0xfffff, half_buffer_size);
}
left = len % half_buffer_size;
// Process remaining incomplete segment data
if (left) {
uint8_t *out = (uint8_t*)i2s_lcd_obj->dma[(x % 2) * i2s_lcd_obj->dma_half_node_cnt].buf;
uint8_t *in = data;
cnt = left - left % 2;
if (cnt) {
if (i2s_lcd_obj->swap_data) {
for (y = 0; y < cnt; y+=2) {
out[y+1] = in[y+0];
out[y+0] = in[y+1];
}
} else {
memcpy(out, in, cnt);
}
}

if (left % 2) {
out[cnt] = in[cnt];
}
lcd_dma_set_left(i2s_lcd_obj, x, left);
xQueueReceive(i2s_lcd_obj->event_queue, (void *)&event, portMAX_DELAY);
lcd_i2s_start(i2s_lcd_obj->i2s_dev, ((uint32_t)&i2s_lcd_obj->dma[(x % 2) * i2s_lcd_obj->dma_half_node_cnt]) & 0xfffff, left);
}

ESP_LOGI("i2s_write_data","xQueueReceive start1");
xQueueReceive(i2s_lcd_obj->event_queue, (void *)&event, portMAX_DELAY);
ESP_LOGI("i2s_write_data","xQueueReceive end1");
}

有没有遇到这种情况的啊?

Who is online

Users browsing this forum: No registered users and 19 guests