Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

SPIM3 not work standalone.

nRF52804 SPIM3 not work.
(SCLK/MOSI not output)

However, if I debug it using jlink, it works. 

My environment is
nRF52840-DK(PCA10056/v1.0.0)
nRF52 SDK 17.0.2

My program is

	/* SCK */
	nrf_gpio_pin_clear(SPIM_CLK_PIN);
	nrf_gpio_cfg(SPIM_CLK_PIN,
						NRF_GPIO_PIN_DIR_OUTPUT,
						NRF_GPIO_PIN_INPUT_CONNECT,
						NRF_GPIO_PIN_NOPULL,
						NRF_GPIO_PIN_S0S1,
						NRF_GPIO_PIN_NOSENSE);
	/* MOSI */
	nrf_gpio_pin_clear(SPIM_MOSI_PIN);
	nrf_gpio_cfg_output(SPIM_MOSI_PIN);
	/* MISO */
	nrf_gpio_cfg_input(SPIM_MISO_PIN, (nrf_gpio_pin_pull_t)NRFX_SPIM_MISO_PULL_CFG);
	/* SS */
	nrf_gpio_pin_set(SPIM_SS_PIN);
	nrf_gpio_cfg_output(SPIM_SS_PIN);

	/**/
    NRFX_IRQ_DISABLE(TARGET_SPIM_IRQ);
	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_FREQUENCY_FREQUENCY_K125;
	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;
	
	SpimReg.EVENTS_END = 0;
	SpimReg.TASKS_START = 1;
	while ( SpimReg.EVENTS_END == 0);

EVENT_END is done.(Maybe the process is finished )
But SCLK and MOSI not output.

Parents Reply
  • Hi,

    I am sorry for late response.

    I added the below code in nRF5_SDK_17.0.2_d674dde\integration\nrfx\legacy\apply_old_config.h

    #if NRFX_CHECK(NRFX_SPIM3_ENABLED)
        #define NRF_DRV_SPI_INSTANCE_3 \
            { 2, { .spim = NRFX_SPIM_INSTANCE(3) }, true }
    #elif NRFX_CHECK(NRFX_SPI3_ENABLED)
        #define NRF_DRV_SPI_INSTANCE_2 \
            { 2, { .spi = NRFX_SPI_INSTANCE(2) }, false }
    #endif

    and enabled NRFX_SPIM3_ENABLED in sdk_config.h and everything on my end is working ok. tested it by connecting two boards with SPI and SPIS examples in nRF5_SDK_17.0.2_d674dde\examples\peripheral\

Children
Related