<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SPI on NCS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79986/spi-on-ncs</link><description>I have been trying to figure out how to use SPI on nRF Connect SDK. I cannot find a simple enough example to get started other than the convoluted SPI flash example or the BME280 and similar ones. 
 Should I use some specific nRF SPI library? I would</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 27 Sep 2021 09:41:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79986/spi-on-ncs" /><item><title>RE: SPI on NCS</title><link>https://devzone.nordicsemi.com/thread/331251?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 09:41:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed8b9a94-624c-4d4b-b9f2-7024fbc52c5d</guid><dc:creator>GPereira</dc:creator><description>&lt;p&gt;After changing the way pointers were being dealt with the code worked:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;mfrc522.c&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void MFRC522_WriteRegister(uint8_t reg, uint8_t value){
    const struct spi_cs_control mfrc522_cs = {
    .gpio_dev = cs_dev,
    .gpio_pin = MFRC522_CS_PIN,
    .delay = 0,
    .gpio_dt_flags = MFRC522_CS_FLAGS,
    };

    const struct spi_config spi_conf = {
	.frequency = 200000,
	.operation = SPI_WORD_SET(8) | SPI_TRANSFER_MSB,
	.slave = 0,
	.cs = &amp;amp;mfrc522_cs,
    };

    struct spi_buf_set tx_bufs;
	struct spi_buf txb[2];

    txb[0].buf = &amp;#174;
	txb[0].len = 1;
    txb[1].buf = &amp;amp;value;
	txb[1].len = 1;

	tx_bufs.buffers = (const struct spi_buf *)&amp;amp;txb;
	tx_bufs.count = 2;

	spi_write(spi_dev, &amp;amp;spi_conf, &amp;amp;tx_bufs);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>