<?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 + ESP32 connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83980/nrf52832-esp32-connection</link><description>Hi all, 
 First of all, this is a new field for me, so I&amp;#39;m quite a beginner here. I&amp;#39;m connecting my ESP32 to wifi and I want to send somehow the IP it connects to, to the nRF52832 in my nRF52 Dev Kit. 
 The Nordic chip doesn&amp;#39;t have any library like SoftwareSerial</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Jan 2022 14:32:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83980/nrf52832-esp32-connection" /><item><title>RE: nRF52832 + ESP32 connection</title><link>https://devzone.nordicsemi.com/thread/349302?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 14:32:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da075321-3961-402c-8cfa-ea93206ca5b5</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Connect the proper wires and the SPI event handler will print the content of the RX buffer as long as the first bye is non-zero.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 + ESP32 connection</title><link>https://devzone.nordicsemi.com/thread/349291?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 14:09:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4ba9685-4b22-4725-befe-f1b1f099f340</guid><dc:creator>pgonzaleztrucorp</dc:creator><description>&lt;p&gt;I flashed it and&amp;nbsp;connected it to a terminal. Without connecting the ESP32 I can see &amp;quot;&amp;lt;info&amp;gt; app: Transfer completed.&amp;quot; all the time.&lt;/p&gt;
&lt;p&gt;Now, what do I have to do in order to receive data from the ESP32?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 + ESP32 connection</title><link>https://devzone.nordicsemi.com/thread/349230?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 12:06:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e755303b-2b0a-4184-b7ce-ca19b91550e4</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;looks like the nrfx example does not build for the nRF52832 out of the box, so instead, I want you to use the&amp;nbsp;&lt;a title="SPI Master Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/spi_master_example.html?cp=8_1_4_6_37"&gt;SPI Master Example&lt;/a&gt;.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;For reference here&amp;#39;s the main.c file:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Copyright (c) 2015 - 2021, Nordic Semiconductor ASA
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 *
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 *
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
#include &amp;quot;nrf_drv_spi.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;

#define SPI_INSTANCE  0 /**&amp;lt; SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);  /**&amp;lt; SPI instance. */
static volatile bool spi_xfer_done;  /**&amp;lt; Flag used to indicate that SPI instance completed the transfer. */

#define TEST_STRING &amp;quot;Nordic&amp;quot;
static uint8_t       m_tx_buf[] = TEST_STRING;           /**&amp;lt; TX buffer. */
static uint8_t       m_rx_buf[sizeof(TEST_STRING) + 1];    /**&amp;lt; RX buffer. */
static const uint8_t m_length = sizeof(m_tx_buf);        /**&amp;lt; Transfer length. */

/**
 * @brief SPI user event handler.
 * @param event
 */
void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
                       void *                    p_context)
{
    spi_xfer_done = true;
    NRF_LOG_INFO(&amp;quot;Transfer completed.&amp;quot;);
    if (m_rx_buf[0] != 0)
    {
        NRF_LOG_INFO(&amp;quot; Received:&amp;quot;);
        NRF_LOG_HEXDUMP_INFO(m_rx_buf, strlen((const char *)m_rx_buf));
    }
}

int main(void)
{
    bsp_board_init(BSP_INIT_LEDS);

    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_DEFAULT_BACKENDS_INIT();

    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    spi_config.ss_pin   = SPI_SS_PIN;
    spi_config.miso_pin = SPI_MISO_PIN;
    spi_config.mosi_pin = SPI_MOSI_PIN;
    spi_config.sck_pin  = SPI_SCK_PIN;
    APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, spi_event_handler, NULL));

    NRF_LOG_INFO(&amp;quot;SPI example started.&amp;quot;);

    while (1)
    {
        // Reset rx buffer and transfer done flag
        memset(m_rx_buf, 0, m_length);
        spi_xfer_done = false;

        APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, m_length));

        while (!spi_xfer_done)
        {
            __WFE();
        }

        NRF_LOG_FLUSH();

        bsp_board_led_invert(BSP_BOARD_LED_0);
        nrf_delay_ms(200);
    }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I want you to change line 57 from &amp;quot;static uint8_t&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;m_rx_buf[sizeof(TEST_STRING) + 1];&amp;nbsp; &amp;nbsp; /**&amp;lt; RX buffer. */&amp;quot; to:&lt;br /&gt;&amp;quot;static uint8_t&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;m_rx_buf["size of the IP address in bytes" + 1];&amp;nbsp; &amp;nbsp; /**&amp;lt; RX buffer. */&amp;quot;&lt;br /&gt;&lt;br /&gt;And change line 98 from &amp;quot;APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, m_length));&amp;quot; to:&lt;br /&gt;&amp;quot;&lt;span&gt;APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, sizeof(m_rx_buf));&lt;br /&gt;&lt;br /&gt;Then compile, flash, and connect the nRF52DK to a terminal, like putty, etc.&amp;nbsp;&lt;br /&gt;The example will start an SPI transfer every 200ms, set by nrf_delay_ms() in the main loop.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 + ESP32 connection</title><link>https://devzone.nordicsemi.com/thread/349202?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 10:59:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0376f0b-ca64-450d-bdc4-0ea31b68aaa3</guid><dc:creator>pgonzaleztrucorp</dc:creator><description>[quote userid="13562" url="~/f/nordic-q-a/83980/nrf52832-esp32-connection/349158#349158"]The first thing you need to do is find out whether the ESP operates as an SPI master or slave.&amp;nbsp;[/quote]
&lt;p&gt;It&amp;#39;s just connected to wifi and then I go to http://&amp;quot;WiFi.localIP()&amp;quot;, that localIP is the one I want to send to my nordic in any way.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s say I configure it as slave_sender and send successfully the IP.&lt;/p&gt;
&lt;p&gt;If I use nrfx SPI Master Example, how can I test this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 + ESP32 connection</title><link>https://devzone.nordicsemi.com/thread/349158?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 09:39:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7abe2433-63a8-4dc3-b460-3be892e283fc</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Hey pablo,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The first thing you need to do is find out whether the ESP operates as an SPI master or slave.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The second thing you need to do is study the corresponding&amp;nbsp;&lt;a title="nrfx SPI Master Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/nrfx_spim_example.html?cp=8_1_4_6_38"&gt;nrfx SPI Master Example&lt;/a&gt;&amp;nbsp;or&amp;nbsp;&lt;a title="SPI Slave Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/spi_slave_example.html?cp=8_1_4_6_39"&gt;SPI Slave Example&lt;/a&gt;. In both cases the received data will accessable in the event handler after an SPI transaction has completed.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Let me know when you get stuck and we&amp;#39;ll help you further.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>