硬件环境:omap3730的核心板,SPI1,CS0外接tsc2046i tp芯片,CS2 外接一个spi CMOS Sensor。
软件环境:ti-dvsdk_dm3730-evm_04_03_00_06
u-boot pinmux配置信息如下:
MUX_VAL(CP(ETK_D5_ES2 ), (IEN | PTU | DIS | M4)) /*GPIO_19 pendown irq*/\
MUX_VAL(CP(MCSPI1_CLK), (IEN | PTD | DIS | M0)) /*MCSPI1_CLK*/\
MUX_VAL(CP(MCSPI1_SIMO), (IEN | PTD | DIS | M0)) /*MCSPI1_SIMO*/\
MUX_VAL(CP(MCSPI1_SOMI), (IEN | PTD | DIS | M0)) /*MCSPI1_SOMI*/\
MUX_VAL(CP(MCSPI1_CS0), (IEN | PTD | EN | M0)) /*McSPI1_CS0*/\
MUX_VAL(CP(MCSPI1_CS1), (IEN | PTD | EN | M0)) /*McSPI1_CS1*/\
MUX_VAL(CP(MCSPI1_CS2), (IEN | PTD | EN | M0)) /*McSPI1_CS2*/\
内核下配置TP:
struct ads7846_platform_data ads7846_config = {
.x_max = 0x0fff,
.y_max = 0x0fff,
// .x_plate_ohms = 180,
// .pressure_max = 255,
.debounce_max = 10,
.debounce_tol = 5,
.debounce_rep = 1,
.get_pendown_state = ads7846_get_pendown_state,
.keep_vref_on = 1,
.settle_delay_usecs = 150,
.wakeup = true,
.swap_xy = 1,
};
static struct omap2_mcspi_device_config ads7846_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1, /* 0: slave, 1: master */
};
[0] = {
.modalias = "ads7846",
.bus_num = 1,
.chip_select = 0,
.max_speed_hz = 1500000,
.controller_data = &ads7846_mcspi_config,
.irq = OMAP_GPIO_IRQ(OMAP3_AUTOGET_TS_GPIO),
.platform_data = &ads7846_config,
},
启动后,若tp和sensor同时连接,tp识别不到,Sensor工作正常,启动log如下:
ads7846 spi1.0: touchscreen, irq 179
ads7846 spi1.0: no device detected, test read result was 0x00000000
但,如果断开sensor连接,则tp能够正常识别。通过示波器抓取spi信号,发现两个device同时连接时,mosi信号有些差异,具体如图:
左边是单独连接TP的,右边是同时连接sensor的;SPI的3条线加上CS0与CS2共5条线是全部直接从核心卡出来引入到IC里面的,外面没有挂接任何器件。
不知spi cs0/2连接两个device时,怎么会有这种影响?有没有什么办法优化SPI信号质量?
Chris Meng:
Yan Zhang14左边是单独连接TP的
单独连接的时候是否3730的spi的MOSI和sensor有断开?