<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/88435/zephyr-spim-does-not-receive-any-data-from-miso-pin</link><description>Hello, 
 
 I&amp;#39;m trying to move from nRF5 SDK with nRF52840 to NCS with nRF5340 and experiencing a lot of problems replacing the nrf driver functions with nrfx. 
 
 Thanks to the other precedents in the devzone, I implemented all the functions except the</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 15 Jun 2022 15:46:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/88435/zephyr-spim-does-not-receive-any-data-from-miso-pin" /><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/372645?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2022 15:46:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5978cc97-5283-4838-9605-22b5440fddf1</guid><dc:creator>user14926</dc:creator><description>&lt;p&gt;Unfortunately, I do not know what could be the issue in your case. Can you share your project with me? Then I can debug the problem and try to find a solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/372051?ContentTypeID=1</link><pubDate>Mon, 13 Jun 2022 08:57:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:433b02aa-7d6b-4c54-ab14-6bf7bdbfee7a</guid><dc:creator>user94037</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry to rush you but is there any additional advice I can try...?&lt;/p&gt;
&lt;p&gt;As I replied, both changing the pin definition and commenting out the calls not worked at all in my case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/371601?ContentTypeID=1</link><pubDate>Thu, 09 Jun 2022 09:20:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8bb04ae-b3a1-4af1-9b7d-7e1468f5a817</guid><dc:creator>user94037</dc:creator><description>[quote userid="14926" url="~/f/nordic-q-a/88435/zephyr-spim-does-not-receive-any-data-from-miso-pin/371475#371475"]Did you try changing the pin definitions in the file I linked, and/or comment out the calls to&amp;nbsp;&lt;span&gt;soc_secure_gpio_pin_mcu_select()?&lt;/span&gt;[/quote]
&lt;p&gt;&amp;nbsp;At first, I thought the file means child image but it was not.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;So, I tried both referencing out and changing the pin assignment&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void remoteproc_mgr_config(void)
{
	/* UARTE */
	/* Assign specific GPIOs that will be used to get UARTE from
	 * nRF5340 Network MCU.
	 */
	// CPUNET_UARTE_PORT_TRX-&amp;gt;PIN_CNF[CPUNET_UARTE_PIN_TX] =
	// 	GPIO_PIN_CNF_MCUSEL_NetworkMCU &amp;lt;&amp;lt; GPIO_PIN_CNF_MCUSEL_Pos;
	// CPUNET_UARTE_PORT_TRX-&amp;gt;PIN_CNF[CPUNET_UARTE_PIN_RX] =
	// 	GPIO_PIN_CNF_MCUSEL_NetworkMCU &amp;lt;&amp;lt; GPIO_PIN_CNF_MCUSEL_Pos;
	// NRF_P0-&amp;gt;PIN_CNF[CPUNET_UARTE_PIN_RTS] =
	// 	GPIO_PIN_CNF_MCUSEL_NetworkMCU &amp;lt;&amp;lt; GPIO_PIN_CNF_MCUSEL_Pos;
	// NRF_P0-&amp;gt;PIN_CNF[CPUNET_UARTE_PIN_CTS] =
	// 	GPIO_PIN_CNF_MCUSEL_NetworkMCU &amp;lt;&amp;lt; GPIO_PIN_CNF_MCUSEL_Pos;

	/* Route Bluetooth Controller Debug Pins */
	// DEBUG_SETUP();

	/* Retain nRF5340 Network MCU in Secure domain (bus
	 * accesses by Network MCU will have Secure attribute set).
	 */
	NRF_SPU-&amp;gt;EXTDOMAIN[0].PERM = 1 &amp;lt;&amp;lt; 4;
}
#endif /* !CONFIG_TRUSTED_EXECUTION_NONSECURE */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;As the remoteproc_mgr_config() function differs from the thread (there is no soc_secure_gpio_pin_mcu_select() I think), I referenced all the content of that function. But the P0.10 still not working&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* This should come from DTS, possibly an overlay. */
#if defined(CONFIG_BOARD_bcc_NRF5340_CPUAPP)
// #define CPUNET_UARTE_PIN_TX  1
// #define CPUNET_UARTE_PIN_RX  0
// #define CPUNET_UARTE_PORT_TRX NRF_P1
// #define CPUNET_UARTE_PIN_RTS 11
// #define CPUNET_UARTE_PIN_CTS 10

#define CPUNET_UARTE_PIN_TX  2
#define CPUNET_UARTE_PIN_RX  3
#define CPUNET_UARTE_PORT_TRX NRF_P0
#define CPUNET_UARTE_PIN_RTS 0
#define CPUNET_UARTE_PIN_CTS 1
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Also, assigning other pins did not work. I modified the nrf5340_cpunet_reset.c like upper code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/371475?ContentTypeID=1</link><pubDate>Wed, 08 Jun 2022 15:24:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29a68c47-af9c-495f-b033-6e2346439538</guid><dc:creator>user14926</dc:creator><description>&lt;p&gt;The pins are still assigned to the network core domain, even if they are not used by the UART interface. Did you try changing the pin definitions in the file I linked, and/or comment out the calls to&amp;nbsp;&lt;span&gt;soc_secure_gpio_pin_mcu_select()?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/371008?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2022 02:06:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d1a4d12-ee49-4c78-aa36-a3cb0b94911b</guid><dc:creator>user94037</dc:creator><description>&lt;p&gt;I also disabled CONFIG_LOG of the network core according to &lt;a href="https://test-devzone.nordicsemi.com/f/nordic-q-a/71690/hardware-cs-not-working-when-using-ble-with-nrf5340dk/295816#295816"&gt;this thread&lt;/a&gt; but it still not works&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/371007?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2022 01:47:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c147cfb3-60a1-4670-bcd3-b5878658fc61</guid><dc:creator>user94037</dc:creator><description>[quote userid="14926" url="~/f/nordic-q-a/88435/zephyr-spim-does-not-receive-any-data-from-miso-pin/370909#370909"]It is possible that P0.10 is assigned to the Network core for its UART instance[/quote]
&lt;p&gt;As you told me, I checked the network core and found the child image &amp;#39;hci_rpmsg&amp;#39; uses pin P0.10 for the UART instance and zephyr functions.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/_091173110F11731105117511AB1109116311BA11_-2022_2D00_06_2D00_07-_0B1169110C116511AB11_-10.40.47.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/_091173110F11731105117511AB1109116311BA11_-2022_2D00_06_2D00_07-_0B1169110C116511AB11_-10.41.15.png" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;As I need to use P0.10, P0.11, and P1.1 for other purposes, I modified the cpu_net overlay file like following&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The overlay file is located in the sdk/zephyr/samples/bluetooth/hci_rpmsg&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/_091173110F11731105117511AB1109116311BA11_-2022_2D00_06_2D00_07-_0B1169110C116511AB11_-10.46.01.png" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;However, the SPI data still not coming via P0.10...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/370909?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 13:55:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dea0688c-ce6f-4228-a8b2-22c2d2a22b10</guid><dc:creator>user14926</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It is possible that P0.10 is assigned to the Network core for its UART instance, see &lt;a href="https://test-devzone.nordicsemi.com/f/nordic-q-a/59254/can-not-control-p1-with-nrf5340_dk_nrf5340_cpuappns-configuration/241984#241984"&gt;this thread&lt;/a&gt; and &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/boards/arm/nrf5340dk_nrf5340/nrf5340_cpunet_reset.c#L20"&gt;this file&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/370781?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 01:47:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e297898d-38df-471a-8e0a-c8e19d1bb881</guid><dc:creator>user94037</dc:creator><description>[quote userid="14926" url="~/f/nordic-q-a/88435/zephyr-spim-does-not-receive-any-data-from-miso-pin/370243#370243"]Typically if you are not able to read the pin, it is configured for use/assigned to another peripheral.[/quote]
&lt;p&gt;&amp;nbsp;Just as Jorgen said, it seems like the pin P0.10 is assigned as another function. When I change the pin P0.20 as the MISO, for example, the SPI works well.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Even if I tried to assign P0.10 as GPIO output via nRF GPIO HAL, it does not work...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;What peripheral can take P0.10? The nRF Connect extension of the VS code says that pin is unconnected&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/_A4C26CD0B0B9F7C0_-2022_2D00_06_2D00_03-_24C604C8_-10.45.14.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/370758?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 18:24:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3c2b511-663b-4b2b-86ce-794087551f97</guid><dc:creator>user94037</dc:creator><description>&lt;p&gt;Also, I defined the pins for GPIO and SPI in the main.c file as following&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Pins for electrical recording and stimulation
#define pin_stim_enable                 NRF_GPIO_PIN_MAP(0, 17)
#define pin_mux_rec_sel0                NRF_GPIO_PIN_MAP(0, 21)
#define pin_mux_rec_sel1                NRF_GPIO_PIN_MAP(0, 16)
#define pin_mux_rec_sel2                NRF_GPIO_PIN_MAP(0, 14)
#define pin_mux_stim_sel0               NRF_GPIO_PIN_MAP(0, 6)
#define pin_mux_stim_sel1               NRF_GPIO_PIN_MAP(0, 24)
#define pin_mux_stim_sel2               NRF_GPIO_PIN_MAP(0, 22)
#define pin_mux_rec_enable              NRF_GPIO_PIN_MAP(0, 20)
#define pin_mux_stim_enable             NRF_GPIO_PIN_MAP(0, 8)
#define pin_vstart						NRF_GPIO_PIN_MAP(0, 26)

// Pins for SPI with variable resistor to control electrical stimulation waveform
#define pin_spim_stim_CS				NRF_GPIO_PIN_MAP(1, 12)
#define pin_spim_stim_MISO				NRF_GPIO_PIN_MAP(1, 3)
#define pin_spim_stim_MOSI				NRF_GPIO_PIN_MAP(1, 7)
#define pin_spim_stim_CLK				NRF_GPIO_PIN_MAP(1, 1)

// Pins for SPI with FPGA which decimates ADC&amp;#39;s output
#define pin_spim_adc_CS					NRF_GPIO_PIN_MAP(0, 9)
#define pin_spim_adc_MISO				NRF_GPIO_PIN_MAP(0, 10)
#define pin_spim_adc_MOSI				NRF_GPIO_PIN_MAP(0, 11)
#define pin_spim_adc_CLK				NRF_GPIO_PIN_MAP(0, 12)
#define pin_spim_fpga_ind				NRF_GPIO_PIN_MAP(0, 19)
#define pin_fpga_osc_enable				NRF_GPIO_PIN_MAP(0, 27)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/370756?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 18:22:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73c9ddcb-674c-4a80-8cbe-a182d1364a5c</guid><dc:creator>user94037</dc:creator><description>&lt;p&gt;Sorry for the late reply :(&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, this is my overlay file for the nrf5340dk&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.
// For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
&amp;amp;led0 {
    gpios = &amp;lt;&amp;amp;gpio0 1 GPIO_ACTIVE_LOW&amp;gt;;
};

&amp;amp;button1 {
    gpios = &amp;lt;&amp;amp;gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)&amp;gt;;
};


&amp;amp;qspi {
    status = &amp;quot;disabled&amp;quot;;
};

&amp;amp;pwm0 {
    status = &amp;quot;disabled&amp;quot;;
};

&amp;amp;uart0 {
    status = &amp;quot;okay&amp;quot;;
    tx-pin = &amp;lt;2&amp;gt;;
    rx-pin = &amp;lt;3&amp;gt;;
    rts-pin = &amp;lt;0&amp;gt;;
    cts-pin = &amp;lt;1&amp;gt;;
};

// I had to disable these to use the requested pins.
&amp;amp;spi2 {
    status = &amp;quot;disabled&amp;quot;;
};

&amp;amp;i2c1 {
    status = &amp;quot;disabled&amp;quot;;
};

&amp;amp;button2 {
    status = &amp;quot;disabled&amp;quot;;
};

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And this is the prj.conf file&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_GPIO=y
CONFIG_PRINTK=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;BCC_SAC_TEST&amp;quot;
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_NUS_THREAD_STACK_SIZE=2048
CONFIG_THREAD_NAME=y


CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n

CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_MAX_CONN=1
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=251

# Enable the NUS service
CONFIG_BT_NUS=y

# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_DEBUG_THREAD_INFO=y

# Config logger
CONFIG_LOG=n

CONFIG_ASSERT=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y

CONFIG_SPI=n
CONFIG_NRFX_SPIM=y
CONFIG_NRFX_SPIM1=y
CONFIG_NRFX_SPIM2=y
CONFIG_NRFX_GPIOTE=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Should I disable something else??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr SPIM does not receive any data from MISO pin</title><link>https://test-devzone.nordicsemi.com/thread/370243?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 13:19:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a89411b-e1fc-47f9-8903-906d209237f7</guid><dc:creator>user14926</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Which pin are you using for&amp;nbsp;&lt;span&gt;MISO on the nRF5340? Typically if you are not able to read the pin, it is configured for use/assigned to another peripheral.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you post your overlay and prj.conf files?&lt;/span&gt;&lt;/p&gt;
[quote user=""]&amp;nbsp;P.S. The code crashes when I locate the bt_nus_data_send() in the SPIM handler but there was no problem doing so with ble_nus_data_send(). Is this the problem of priority which was managed by SoftDevice before?[/quote]
&lt;p&gt;&lt;span&gt;Sounds like it could be a priority issue, yes. What is the error when it crashes? You have the SPIM priority set to 2, so that is quite high. Have you tried lowering the priority?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>