<?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>Switching between i2c and spi on the same pins while in runtime</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95370/switching-between-i2c-and-spi-on-the-same-pins-while-in-runtime</link><description>Hello, 
 is it possible to switch between i2c and spi in the same pins in runtime? 
 I&amp;#39;m trying to evaluate a sensor where it can communicate over spi or i2c on the same connector, is it possible to switch between the protocols while using the same pins</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Jan 2023 15:06:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95370/switching-between-i2c-and-spi-on-the-same-pins-while-in-runtime" /><item><title>RE: Switching between i2c and spi on the same pins while in runtime</title><link>https://devzone.nordicsemi.com/thread/403452?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2023 15:06:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58ba5c2d-27d4-4981-829d-5d14df750a01</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;To accomplish this you can use the nrfx drivers directly instead of the zephyr drivers for i2c and spi. With the nrfx drivers you can uninit one peripheral then init the other with the same pins to switch between them. Both peripherals should be disabled in the devicetree, for example using an overlay file.&lt;/p&gt;
&lt;p&gt;We have samples here for using the nrfx drivers directly: &lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src"&gt;https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;These samples can also be found in the SDK at v2.2.0/modules/hal/nordic/nrfx/samples/src.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>