D1的SPI,空闲的时候是低电平,而且每个字节CLK 有9个脉冲,如图所示:
以下是SPI的配置
如果想将空闲时变成高电平,以及每个字节的CLK设为8个,可以尝试通过一下两个角度去分析。
SPI通讯的问题首先考虑是不是 spi_dbi_enable
的问题,目前 spi_dbi_enable
设置的是1,在将 spi_dbi_enable
设置为0后CLK,MOSI都没有数据了。
其实spi_dbi_enable
是spi lcd显示屏专用的驱动,配置两个逻辑不太一样
配置lcd屏幕需要单独写lcd的配置
&lcd_fb0 {
lcd_used = <1>;
lcd_driver_name = "kld2844b";
lcd_if = <1>;
lcd_dbi_if = <4>;
lcd_data_speed = <60>;
lcd_spi_bus_num = <1>;
lcd_x = <240>;
lcd_y = <320>;
lcd_width = <60>;
lcd_height = <95>;
lcd_pwm_used = <1>;
lcd_pwm_ch = <7>;
lcd_pwm_freq = <5000>;
lcd_pwm_pol = <0>;
lcd_pixel_fmt = <0>;
lcd_dbi_fmt = <3>;
lcd_rgb_order = <0>;
lcd_frm = <1>;
lcd_gamma_en = <1>;
fb_buffer_num = <2>;
lcd_backlight = <100>;
lcd_dbi_te = <1>;
lcd_fps = <60>;
lcd_gpio_0 = <&pio PC 0 GPIO_ACTIVE_HIGH>; // reset
status = "okay";
};
另外检查一下,spi-rx-bus-width=<0x04>
是四线spi驱动,需要确认从机是4bit SPI <D0 D1 D2 D3 CLK CS>
,否则请改成 spi-rx-bus-width=<0x01>
;