My environment is
nRF52840 + nRF5 SDK 17
I have nRF52840 and LCD module(ER-TFTM101-1) connected using SPIM2.
When LCD power is on, It's fine work.
But,
When LCD power is off, SPIM never STOP.
Follow is simple test code
/* SCK */
nrf_gpio_pin_drive_t pin_drive = NRF_GPIO_PIN_S0S1;
nrf_gpio_pin_write(SPIM_CLK_PIN, 0);
nrf_gpio_cfg(SPIM_CLK_PIN,
NRF_GPIO_PIN_DIR_OUTPUT,
NRF_GPIO_PIN_INPUT_CONNECT,
NRF_GPIO_PIN_NOPULL,
pin_drive,
NRF_GPIO_PIN_NOSENSE);
/* MOSI */
nrf_gpio_pin_write(SPIM_MOSI_PIN, 0);
nrf_gpio_cfg(SPIM_MOSI_PIN,
NRF_GPIO_PIN_DIR_OUTPUT,
NRF_GPIO_PIN_INPUT_DISCONNECT,
NRF_GPIO_PIN_NOPULL,
pin_drive,
NRF_GPIO_PIN_NOSENSE);
/* MISO */
nrf_gpio_cfg(SPIM_MISO_PIN,
NRF_GPIO_PIN_DIR_INPUT,
NRF_GPIO_PIN_INPUT_CONNECT,
NRF_GPIO_PIN_NOPULL,
pin_drive,
NRF_GPIO_PIN_NOSENSE);
/* SS */
nrf_gpio_pin_write(SPIM_SS_PIN, 1);
nrf_gpio_cfg(SPIM_SS_PIN,
NRF_GPIO_PIN_DIR_OUTPUT,
NRF_GPIO_PIN_INPUT_DISCONNECT,
NRF_GPIO_PIN_NOPULL,
pin_drive,
NRF_GPIO_PIN_NOSENSE);
SpimReg.ENABLE = SPIM_ENABLE_ENABLE_Enabled << SPIM_ENABLE_ENABLE_Pos;
SpimReg.TASKS_STOP = 1;
SpimReg.PSEL.SCK = SPIM_CLK_PIN;
SpimReg.PSEL.MOSI = SPIM_MOSI_PIN;
SpimReg.PSEL.MISO = SPIM_MISO_PIN;
SpimReg.FREQUENCY = SPIM_FREQ;
SpimReg.RXD.PTR = uint32_t(m_recv_buff),
SpimReg.RXD.MAXCNT = 2;
SpimReg.RXD.LIST = 0;
SpimReg.TXD.PTR = uint32_t(m_send_buff),
SpimReg.TXD.MAXCNT = 2;
SpimReg.TXD.LIST = 0;
SpimReg.CONFIG = 0; /* active-high / Leading / MsbFirst */
SpimReg.ORC = 0x00;
actCS(true); /* assert CS */
SpimReg.EVENTS_END = 0;
SpimReg.TASKS_START = 1;
EVENTS_STARTED is 1
EVENTS_STOPPED/EVENTS_ENDRX/EVENTS_END/EVENTS_ENDTX never be 1.
in the above condition,
when LCD power is turned on, EVENTS_STOPPED/EVENTS_ENDRX/EVENTS_END/EVENTS_ENDTX is 1.
after that, when LCD power is turned off,
Again, When TASKS_START set 1, EVENTS_STARTED and EVENTS_STOPPED/EVENTS_ENDRX/EVENTS_END/EVENTS_ENDTX is 1.
how is this going?
** SPIM returns EVENT_STOP if the SCLK signal line is determined while the LCD is power down.