How to read SPI TX & RX data register status full or empty..?

Hi,

I want to get the SPI data register status regarding if they are full or empty.!
Kindly guide me with relevant APIs i can use.

Thanks,

Parents
  • Hi

    The SPI slave peripheral for instance uses two memory pointers RXD.PTR and TXD.PTR, that point to the RXD buffer and TXD buffer respectively. Since these buffers are located in RAM, it can be accessed by both the SPI slave and the CPU.

    I'm afraid we don't have a specific code example doing this already, but you should be able to implement it by referring to the SPI slave operation description and registers in the product specification.

    Best regards

    Simon

  • Hello Simon,

    Thanks for the info, I am using nCS as in zephyr driver model,
    So can I use something specific to zephyr..?

    For example in spi_context.h, I noticed APIs like:

    bool spi_context_tx_on(struct spi_context *ctx)
    {
    return !!(ctx->tx_len);
    }
    
    bool spi_context_rx_on(struct spi_context *ctx)
    {
    return !!(ctx->rx_len);
    }
    
    bool spi_context_rx_buf_on(struct spi_context *ctx)
    {
    return !!(ctx->rx_buf && ctx->rx_len);
    }



    Is this SPI Context already pointing to RXD.PTR and TXD.PTR for nordic board..?

    Can i use above APIs..?


Reply
  • Hello Simon,

    Thanks for the info, I am using nCS as in zephyr driver model,
    So can I use something specific to zephyr..?

    For example in spi_context.h, I noticed APIs like:

    bool spi_context_tx_on(struct spi_context *ctx)
    {
    return !!(ctx->tx_len);
    }
    
    bool spi_context_rx_on(struct spi_context *ctx)
    {
    return !!(ctx->rx_len);
    }
    
    bool spi_context_rx_buf_on(struct spi_context *ctx)
    {
    return !!(ctx->rx_buf && ctx->rx_len);
    }



    Is this SPI Context already pointing to RXD.PTR and TXD.PTR for nordic board..?

    Can i use above APIs..?


Children
Related