Nrf54L15 SPI Mastter Moe CLK And Recive

I am using the official Nrodic SPI exercise with the Nrf54L15 DK board,
Here is the code
// my code official code
// overlay


&spi21 {
 compatible = "nordic,nrf-spim";
 status = "okay";
 pinctrl-0 = <&spi21_default>;
 pinctrl-1 = <&spi21_sleep>;
 pinctrl-names = "default", "sleep";
 cs-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
 bme280: bme280@0 {
 compatible = "bosch,bme280";
 reg = <0>;
 spi-max-frequency = <1000000>;
 };
};


// Code is (my code) bsp_spi.c

   
#define SPIOP_MODE_0            SPI_WORD_SET(8) | SPI_TRANSFER_MSB | (0x00 << 1)

#define SPIOP_MODE_1            SPI_WORD_SET(8) | SPI_TRANSFER_MSB | (0x02 << 1)

#define SPIOP_MODE_2            SPI_WORD_SET(8) | SPI_TRANSFER_MSB | (0x01 << 1)

#define SPIOP_MODE_3            SPI_WORD_SET(8) | SPI_TRANSFER_MSB | (0x03 << 1)


struct spi_dt_spec  mouse_spi_sepc[SPI_DEVICE_UNKNOW] = {
    SPI_DT_SPEC_GET(DT_NODELABEL(bme280), SPIOP_MODE_0, 0),
//     // SPI_DT_SPEC_GET(DT_NODELABEL(ws2812),  SPIOP_MODE_3, 0),
//     // SPI_DT_SPEC_GET(DT_NODELABEL(ch_usb),  SPIOP_MODE_3, 0)
};

unsigned int bsp_spi_init()
{


    if ( !( spi_is_ready_dt(&spispec) ) )
    {
        BSP_DEBUG_LOG("Error: SPI device_ID is not ready, err\n");
        return BSP_SPI_ERROR_CODE;
    }

    return 0;
}

uint8_t tx_buffer = 0x34;
uint8_t data[2] ;
struct spi_buf tx_spi_buf		    = {.buf = (void*)&tx_buffer, .len = 1};
struct spi_buf_set tx_spi_buf_set 	= {.buffers = &tx_spi_buf, .count = 1};
struct spi_buf rx_spi_bufs 		    = {.buf = &data[0], .len = 1};
struct spi_buf_set rx_spi_buf_set	= {.buffers = &rx_spi_bufs, .count = 1};

void bsp_spi_dsadaa()
{
    int err;
    BSP_DEBUG_LOG("rx_spi_buf len :%d \n", rx_spi_bufs.len);
    err = spi_transceive_dt(&spispec, &tx_spi_buf_set, &rx_spi_buf_set);
    if (err < 0) {
    BSP_DEBUG_LOG("spi_transceive_dt() failed, err: %d", err);
    }
}

but my  (use logic look) spi read clk No CLK !!!

But it will 。 But there is CLK, but only one。
struct spi_buf rx_spi_bufs 		    = {.buf = &data[0], .len = 2};
Why????? I am ch, mabe speak english not , I hope Slove Problem

Parents Reply Children
  • my prj.conf

    # enable console
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    # 启用RTT核心功能
    CONFIG_USE_SEGGER_RTT=n
    
    #Enable hadware stack protection
    CONFIG_HW_STACK_PROTECTION=y
    
    #Enable MPU
    CONFIG_ARM_MPU=y
    
    #日志
    CONFIG_LOG_PRINTK=y
    CONFIG_LOG_BACKEND_RTT=y
    
    # GPIO使能
    CONFIG_GPIO=y
    
    # 使能串口驱动
    CONFIG_SERIAL=y
    CONFIG_UART_ASYNC_API=y
    
    # 使能SPI
    CONFIG_SPI=y
    
    
    # 使能ADC
    CONFIG_ADC=y
           
    # 开启TF-M, 即 末尾 带ns
    CONFIG_TFM_SECURE_UART=n
    CONFIG_TFM_LOG_LEVEL_SILENCE=y

Related