<?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>nRF52832 SPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105333/nrf52832-spi</link><description>Hello, 
 I am attempting to convert my I2c connection to an SPI connection and am stuck on what I need to change (the device is wired for SPI but to I2c pins). 
 I would love to make a device tree node and be able to change the default pins of the SPI</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Dec 2023 23:38:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105333/nrf52832-spi" /><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/460445?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2023 23:38:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf61c1ff-7efc-44b2-9452-5984dde7775d</guid><dc:creator>jbeh444</dc:creator><description>&lt;p&gt;It looks like my problem was I needed to create a binding file instead of using compatible = &amp;quot;spi-device&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/93607/devicetree-spi-device"&gt;Devicetree: SPI device - Nordic Q&amp;amp;A - Nordic DevZone - Nordic DevZone (nordicsemi.com)&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/460220?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2023 19:59:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ff20284-fc7a-4a7e-b264-77f4466e90c0</guid><dc:creator>jbeh444</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I hope your day is going well!&lt;/p&gt;
&lt;p&gt;#1. Is this the right way to create a SPI node?&amp;nbsp;I have scoured the examples you gave me and am still not getting the SPI working.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi0 {
    //compatible = &amp;quot;nordic,nrf-spi&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
    cs-gpios = &amp;lt;&amp;amp;gpio0 28 GPIO_ACTIVE_LOW&amp;gt;; 
    a: spi-dev-a@0 {
        compatible = &amp;quot;spi-device&amp;quot;;
        reg = &amp;lt;0&amp;gt;;
        spi-max-frequency = &amp;lt;10000000&amp;gt;;                      
        //status = &amp;quot;okay&amp;quot;;
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;#2. I need to change the default pins as well. Sck = P0.27, mosi/miso P0.25.&lt;/p&gt;
&lt;p&gt;#3. Can miso/mosi be on the same pin? The sensor I am using uses mosi/miso on the same pin.&lt;/p&gt;
&lt;p&gt;#4. Is this the right way to define the device in my files?&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class="ui-code" data-mode="text"&gt;#define SPI0_NODE DT_NODELABEL(a)
static const struct spi_dt_spec dev_spi = SPI_DT_SPEC_GET(SPI0_NODE, SPI_OP_MODE_MASTER, 0);&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;I am sorry I have read the documentation and must be missing some understanding.&lt;/div&gt;
&lt;div&gt;Thank you in advance for all of your help.&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/455423?ContentTypeID=1</link><pubDate>Mon, 13 Nov 2023 22:19:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24cb4617-a42b-4024-9ca5-5195da38d85a</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The GPIO pins passed to &amp;#39;&lt;span&gt;nrfx_twim_init&amp;#39; will be configured internally in the driver to match the pin configurations recommended in the product specification here:&amp;nbsp;&lt;a title="Master mode pin configuration" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/twim.html?cp=5_2_0_32_6#concept_x2r_gxp_xr"&gt;Master mode pin configuration&lt;/a&gt;. This means you don&amp;#39;t have to initialize the pins yourself.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/1aa7824f45d46b5f81250801868bef050ba72440/drivers/src/nrfx_twim.c#L274"&gt;https://github.com/NordicSemiconductor/nrfx/blob/1aa7824f45d46b5f81250801868bef050ba72440/drivers/src/nrfx_twim.c#L274&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/455200?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2023 20:41:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad5192cf-485f-4ca6-9c9b-a19a35cb2f01</guid><dc:creator>jbeh444</dc:creator><description>[quote userid="77782" url="~/f/nordic-q-a/105333/nrf52832-spi/454761"]You could set the pin&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#c.GPIO_OPEN_DRAIN"&gt;&lt;span&gt;GPIO_OPEN_DRAIN&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span&gt;connected to ground&lt;/span&gt; /&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#c.GPIO_ACTIVE_LOW"&gt;&lt;span&gt;GPIO_ACTIVE_LOW&lt;/span&gt;&lt;/a&gt;&amp;nbsp;for&amp;nbsp;&lt;span&gt;active low. See this&amp;nbsp;&lt;/span&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#general-purpose-input-output-gpio"&gt;General-Purpose Input/Output (GPIO)&lt;/a&gt;&amp;nbsp;doc.&amp;nbsp;[/quote]
&lt;p&gt;The examples are just fragments, and I don&amp;#39;t fully understand how to use them.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I was attempting to make a node for the gpios but it doesn&amp;#39;t seem to work. Is there a working device tree example I could reference. I just want to set pin P0.26 to open drain with minimal steps.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Here is my current overlay file:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*The i2c0 controller and set the address to 0x19 (SDO to VDDIO)(Seeed address) 
                                          or 0x18 (SDO to GND)*/
&amp;amp;i2c0 {   
    mysensor: mysensor@19{ 
        /*changed default sda to 25 by editing nrf52dk_nrf52832-pinctrl.dtsi
        this is located in c:\ncs\v2.4.0\zephyr\boards\arm\nrf52dk_nrf52832 */
        compatible = &amp;quot;i2c-device&amp;quot;;
        status = &amp;quot;okay&amp;quot;;
        reg = &amp;lt; 0x19 &amp;gt;; //
        label = &amp;quot;mysensor&amp;quot;;
        //twim_sda-gpios = &amp;lt;&amp;amp;gpio0 25 0&amp;gt;; 
        /*Turn off when not in use */
        i2c-gpio,disable-on-idle; /*not sure if this works */       
    };
};
// Changed to active high and pull up and worked!!!
&amp;amp;button0{
    gpios = &amp;lt;&amp;amp;gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)&amp;gt;;
};
//set sdo to ground

//uses less power? (seems like 200uA less power on average)
// &amp;amp;uart0 {
//     status = &amp;quot;disabled&amp;quot;;
// };
/*This will setup the voltage divider to measure through voltage divider */
 / {
    vbatt {
       compatible = &amp;quot;voltage-divider&amp;quot;;
       io-channels = &amp;lt;&amp;amp;adc 0&amp;gt;; // battery measure
       output-ohms = &amp;lt;220000&amp;gt;;
       full-ohms = &amp;lt;(1500000 + 220000)&amp;gt;;
       power-gpios = &amp;lt;&amp;amp;gpio0 3 0&amp;gt;; //Battery enable
    };
 };
&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;I just want to make a gpio or reference a node and change 26 to an open drain.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;// #define SDO_NODE DT_NODELABEL(sdo)

//static const struct gpio_dt_spec spec = GPIO_DT_SPEC_GET(SDO_NODE, gpios);

if (!device_is_ready(SDO.port)) {
    return 0;
} &lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/455199?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2023 19:42:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae7b5d51-e685-4c88-982c-afe55042889f</guid><dc:creator>jbeh444</dc:creator><description>&lt;p&gt;I went into here and was able to change the default pins to what I needed.&lt;/p&gt;
&lt;p&gt;C:\ncs\v2.4.0\zephyr\boards\arm\nrf52dk_nrf52832\nrf52dk_nrf52832-pinctrl.dtsi&lt;/p&gt;
&lt;p&gt;please let me know if this is a good solution. Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/455198?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2023 19:28:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96e21e2e-361b-46ca-8b5e-c4059c9dbdbe</guid><dc:creator>jbeh444</dc:creator><description>&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote userid="77782" url="~/f/nordic-q-a/105333/nrf52832-spi/454761"]See the example&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/ff85910bf8ed1aac0571bca0e7f206782234efbb/samples/sensor/adt7420/boards/nrf52dk_nrf52832.overlay"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/ff85910bf8ed1aac0571bca0e7f206782234efbb/samples/sensor/adt7420/boards/nrf52dk_nrf52832.overlay&lt;/a&gt;&amp;nbsp;[/quote]
&lt;p&gt;I didn&amp;#39;t see an example of how to change the pins at this link. Would you happen to know another example? thank you very much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/454761?ContentTypeID=1</link><pubDate>Wed, 08 Nov 2023 17:34:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bb08ef6-9d65-4c1d-b32c-dddd8a3ff449</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
[quote user="jbeh444"]Is there a way to set pin P0.26 to ground or active low or a voltage. How would I go about setting that pin? [/quote]
&lt;p&gt;You could set the pin&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#c.GPIO_OPEN_DRAIN"&gt;&lt;span&gt;GPIO_OPEN_DRAIN&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span&gt;connected to ground&lt;/span&gt; /&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#c.GPIO_ACTIVE_LOW"&gt;&lt;span&gt;GPIO_ACTIVE_LOW&lt;/span&gt;&lt;/a&gt;&amp;nbsp;for&amp;nbsp;&lt;span&gt;active low. See this&amp;nbsp;&lt;/span&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#general-purpose-input-output-gpio"&gt;General-Purpose Input/Output (GPIO)&lt;/a&gt;&amp;nbsp;doc.&amp;nbsp;&lt;/p&gt;
[quote user="jbeh444"]also how do I change the default pins on I2c?&amp;nbsp;[/quote]
&lt;p&gt;See the example&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/ff85910bf8ed1aac0571bca0e7f206782234efbb/samples/sensor/adt7420/boards/nrf52dk_nrf52832.overlay"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/ff85910bf8ed1aac0571bca0e7f206782234efbb/samples/sensor/adt7420/boards/nrf52dk_nrf52832.overlay&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/454559?ContentTypeID=1</link><pubDate>Wed, 08 Nov 2023 00:16:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a165b22d-aa7a-475c-acb8-a9016693be99</guid><dc:creator>jbeh444</dc:creator><description>&lt;p&gt;&lt;span&gt;Is there a way to set pin P0.26 to ground or active low or a voltage. How would I go about setting that pin? This would enable my I2c to work (hopefully).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;also how do I change the default pins on I2c?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;thank you so very much for all of your help!!!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SPI</title><link>https://devzone.nordicsemi.com/thread/454040?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2023 20:08:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:302c56a0-d48b-4b6a-92ed-443c026bc6c0</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Seems your overlay doesn&amp;#39;t set the device correctly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is an example showing how to set the devices tree for connecting SPI sensor on nRF52DK:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/ff85910bf8ed1aac0571bca0e7f206782234efbb/samples/sensor/icm42605/boards/nrf52dk_nrf52832.overlay"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/ff85910bf8ed1aac0571bca0e7f206782234efbb/samples/sensor/icm42605/boards/nrf52dk_nrf52832.overlay&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you&amp;nbsp;want to use the nrfx_spim driver, since the Zephyr driver doesn&amp;#39;t support all the Nordic specific functionality (such as triggering SPI transcations via DPPI), and there are some good nrfx examples available&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would recommend taking a look at one of the nrfx_spim examples and try to setup the SPI in a similar way.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>