Comments (8)
I think we should use the uint16_t array to test the i2s of the 16-bit data width. For example:
uint16_t fb[10] = {0xabab, 0xabab, 0x55af, 0x3d6f, 0x4478, 0xabab, 0xabab, 0x55af, 0x3d6f, 0x4478};
from esp-iot-solution.
I have found an error from hardware. GPIO0 should not be used as LCD_D2_PIN from ESP32-PICO-D4 for some unknown reason(s). Comparing the byte mismatch it is always the GPIO 0 pulled to 0. So I have changed to GPIO9 as LCD_D2_PIN. #define LCD_D2_PIN (9) // 0->9
. And I have tested with uint16_t arrays with result below:
Src code:
DRAM_ATTR static const uint16_t fb[10] = {0xabcd, 0xcdba, 0xab88, 0xac23, 0x5544, 0xaf54, 0x3d2a, 0x6f56, 0x4423, 0x78fa};
for(;;){
i2s_lcd_write_data(d2805_handle, (const uint16_t *)&fb, sizeof(fb), portTICK_PERIOD_MS, false);
vTaskDelay(500 / portTICK_PERIOD_MS);
}
Waveform now matches perfectly but there is an error when compiling because it is a const char *src
in prototype of i2s_lcd_write_data()
. The error as: **expected 'const char *' but argument is of type 'const uint16_t * {aka const short unsigned int *}'**
Another test with uint8_t array with data width changed to 8 does not sound correct:
void app_main()
{
dummy_init();
i2s_lcd_config_t d2805_conf={
8, //data_width = 8
{
LCD_D0_PIN, LCD_D1_PIN, LCD_D2_PIN, LCD_D3_PIN,
LCD_D4_PIN, LCD_D5_PIN, LCD_D6_PIN, LCD_D7_PIN,
//LCD_D8_PIN, LCD_D9_PIN, LCD_D10_PIN,LCD_D11_PIN,
//LCD_D12_PIN, LCD_D13_PIN, LCD_D14_PIN, LCD_D15_PIN
},
LCD_WR_PIN,
LCD_RS_PIN
};
i2s_lcd_handle_t d2805_handle = i2s_lcd_create(I2S_PORT_NUM, &d2805_conf);
DRAM_ATTR static const char fb[10] = {0xab, 0xcd, 0xab, 0x23, 0x44, 0xaf, 0x3d, 0x56, 0x42, 0xfa};
for(;;){
i2s_lcd_write_data(d2805_handle, (const char *)&fb, sizeof(fb), portTICK_PERIOD_MS, false);
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
Screen shot from Logic analyzer:
According to the probe result the byte sequence sent from LCD_D0_PIN[7:0] are 0xab 0xab 0x44 0x3d 0x42
Can't we send with 8-bit 8080?
from esp-iot-solution.
I think the reason why 8-bit didn't work is now clear. Needed to put #define CONFIG_BIT_MODE_8BIT
right at the beginning of i2s_lcd.c to let the system know we are using 8-bit. So I believe the default is 16-bit with definition set somewhere...
#define CONFIG_BIT_MODE_8BIT
is put right next to #include "esp_log.h"
Clean and make flash will give the right waveform for 8-bit:
Thank you
from esp-iot-solution.
Some more findings. It seems there is a problem with iot_i2s_lcd_write_data(i2s_lcd_handle_t i2s_lcd_handle, uint16_t data)
when data width is set to 8BIT
. In i2s_lcd_com.c
the code is :
#ifdef CONFIG_BIT_MODE_8BIT
void iot_i2s_lcd_write_data(i2s_lcd_handle_t i2s_lcd_handle, uint16_t data)
{
i2s_lcd_write_data(i2s_lcd_handle, (char *)&data, 2, 100, true);
}
When 8 bit is defined, data type should be uint8_t, and the 3rd argument should be 1 instead of 2?
Another issue is that, RS pin is never strobed when iot_i2s_lcd_write_cmd(i2s_lcd_handle_t i2s_lcd_handle, uint16_t cmd)
is called.
from esp-iot-solution.
The problem with RS pin never strobed has been solved. Mistake has been made with calling i2s_lcd_create()
without setting the direction of RS pin which is treated as a gpio. Instead of i2s_lcd_create
the function iot_i2s_lcd_pin_cfg()
should be called which include both i2s_lcd_create()
& gpio_set_direction()
for RS pin.
The root of another problem with iot_i2s_lcd_write_cmd(i2s_lcd_handle_t i2s_lcd_handle, uint16_t cmd)
for CONFIG_BIT_MODE_8BIT
seems to be a 8bit left shift (cmd>>8) as follows:
void iot_i2s_lcd_write_cmd(i2s_lcd_handle_t i2s_lcd_handle, uint16_t cmd)
{
i2s_lcd_t *i2s_lcd = (i2s_lcd_t *)i2s_lcd_handle;
i2s_port_t i2s_num = i2s_lcd->i2s_port;
GPIO.out_w1tc = (1 << i2s_lcd->i2s_lcd_conf.rs_io_num);
REG_WRITE(I2S_FIFO_ADD[i2s_num], (cmd >> 8));
I2S[i2s_num]->conf.tx_start = 1;
This function assumed a uint16_t cmd and user should allocate the high byte for the actual command. Example, if 0x2A is wanted one need to send like iot_i2s_lcd_write_cmd(i2s_lcd_handle, 0x2A00)
, but it turns out that a dummy 0x00 is also sent in the tail after 0x2A. Below is a screen shot from analyzer:
from esp-iot-solution.
Hi
After much effort in understanding how i2s_8080 work, it seems 8 bit parallel bus is working OK with modification to two functions in i2s_lcd_com.c.
(1)
#ifdef CONFIG_BIT_MODE_8BIT
void iot_i2s_lcd_write_data(i2s_lcd_handle_t i2s_lcd_handle, uint16_t data)
{
//i2s_lcd_write_data(i2s_lcd_handle, (char *)&data, 2, 100, true); //original
i2s_lcd_write_data(i2s_lcd_handle, (char *)&data, 1, 100, false); //new
}
(2)
void iot_i2s_lcd_write_cmd(i2s_lcd_handle_t i2s_lcd_handle, uint16_t cmd)
{
i2s_lcd_t *i2s_lcd = (i2s_lcd_t *)i2s_lcd_handle;
i2s_port_t i2s_num = i2s_lcd->i2s_port;
GPIO.out_w1tc = (1 << i2s_lcd->i2s_lcd_conf.rs_io_num);
REG_WRITE(I2S_FIFO_ADD[i2s_num], (uint8_t)cmd); //new
I2S[i2s_num]->conf.tx_start = 1;
while (!(I2S[i2s_num]->state.tx_idle)) {
// vTaskDelay(20);
;
}
I2S[i2s_num]->conf.tx_start = 0;
I2S[i2s_num]->conf.tx_reset = 1;
I2S[i2s_num]->conf.tx_reset = 0;
I2S[i2s_num]->conf.tx_fifo_reset = 1;
I2S[i2s_num]->conf.tx_fifo_reset = 0;
GPIO.out_w1ts = (1 << i2s_lcd->i2s_lcd_conf.rs_io_num);
}
Repeat sending command & data in 8-bit 8080 with snippet :
void app_main()
{
i2s_lcd_config_t d2805_conf={
8, //data_width = 8
{
LCD_D0_PIN, LCD_D1_PIN, LCD_D2_PIN, LCD_D3_PIN,
LCD_D4_PIN, LCD_D5_PIN, LCD_D6_PIN, LCD_D7_PIN,
},
LCD_WR_PIN,
LCD_DC_PIN
};
i2s_lcd_handle_t d2805_handle = iot_i2s_lcd_pin_cfg(I2S_PORT_NUM, &d2805_conf);
for(;;){
iot_i2s_lcd_write_cmd(d2805_handle, 0x2A);
iot_i2s_lcd_write_data(d2805_handle, 0xef);
}
}
Dump screen from logic analyzer is shown here.
from esp-iot-solution.
Please see #19
from esp-iot-solution.
The code in 8-BIT 8080 mode is working. Picture shown below for my LCD.
With a logic analyzer WR# pulse frequency is measured to be ~ 13MHz. I can see that the WR# pulse rate is actually BCK clock rate. Its frequency is calculated by Fbck = Fpll /(N + (b/a))/M.
Inside esp_err_t i2s_set_parallel_mode(i2s_port_t i2s_num)
,
I2S[i2s_num]->clkm_conf.clkm_div_b = 1;
I2S[i2s_num]->clkm_conf.clkm_div_a = 0;
I don't understand it when clkm_conf.clkm_div_a is set '0', b/a would be undefined. Why a 13MHz is obtained?
So I tried
I2S[i2s_num]->clkm_conf.clkm_div_b = 0;
I2S[i2s_num]->clkm_conf.clkm_div_a = 1;
``` hoping to get a max. bck rate = 160/2/2 = 40MHz with N=M=2 but the screen no longer works.
from esp-iot-solution.
Related Issues (20)
- where the head file (AEGHB-683) HOT 1
- [espressif/keyboard_button] How to handle previously pressed keycodes? (AEGHB-685) HOT 2
- examples/usb/host/usb_camera_mic_spk (AEGHB-690) HOT 1
- EPS32S3 SH8601 QSPI驱动无法正常使用 (AEGHB-692) HOT 5
- iot_button_get_event无法获取到BUTTON_SINGLE_CLICK,BUTTON_DOUBLE_CLICK事件 (AEGHB-693) HOT 7
- 下载espressif_esp_lcd_st7701_1.1.0压缩包解压后,构建项目提示错误 (AEGHB-694) HOT 2
- LED Indicator组件的led_indicator_start和led_indicator_set_brightness亮度值过渡不连续 (AEGHB-697) HOT 8
- USB_dongle 无法发送命令 (AEGHB-715) HOT 2
- How to enable communication between PC and espS3 with USB dongle burned? (AEGHB-720) HOT 1
- st7701 RGB+SPI display rotation support (AEGHB-721) HOT 1
- Missing documentation (IDFGH-13201) (AEGHB-724) HOT 1
- usb_webcam example no longer working because no versions of espressif/tinyusb match >=0.15.0~10 (AEGHB-730) HOT 13
- ESP32-S3-A7670E-4G 开发板,usb 设备先上电 或者 执行 esp_reset() 后,_usbh_processing_task 无法找到 usb 设备进入无限等待。 (AEGHB-737) HOT 4
- ble_remote_control示例中直接修改val_batt_level无法在手机中看到电量变化 (AEGHB-744)
- Usb_Dongle (AEGHB-761) HOT 1
- [FEATURE] 更新arduino-foc版本,添加adc采样支持,实现电流环 (AEGHB-767) HOT 1
- [esp_simplefoc] error: 'LEDC_USE_APB_CLK' was not declared in this scope; did you mean 'LEDC_USE_XTAL_CLK' (AEGHB-768) HOT 1
- Zero detect: valid_count overflow (AEGHB-775)
- Example usb_camera_mic_spk does not work, prints "Setting format: 0 NOT found" (AEGHB-781) HOT 4
- Add support for encrypted UF2 images (AEGHB-783)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-iot-solution.