<?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>UART Configuration in DFU nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95146/uart-configuration-in-dfu-nrf52840</link><description>Hi, 
 
 I have recently migrated by code from the nRF52832 to the nRF52840 on a custom board. This board uses UART to an STMH7 for the DFU. 
 When trying to do a DFU in the bootloader I get the UART error 12 = 0x1100 which are frame and block mask bits</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Jan 2023 12:16:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95146/uart-configuration-in-dfu-nrf52840" /><item><title>RE: UART Configuration in DFU nRF52840</title><link>https://devzone.nordicsemi.com/thread/403387?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2023 12:16:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7029913-2ff8-4f44-98a1-5e81c23befb0</guid><dc:creator>pressure_sensor_nonconn_adv</dc:creator><description>&lt;p&gt;Thank you that removed the glitch!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Configuration in DFU nRF52840</title><link>https://devzone.nordicsemi.com/thread/403345?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2023 09:57:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7232ccc4-541b-49b5-9d43-5baaf187b1aa</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks. The pin assignment looks to be OK.&lt;/p&gt;
[quote user="pressure_sensor_nonconn_adv"]The error only shows up once the update/transfer from the STM32H7 is started.[/quote]
&lt;p&gt;Is this when the UART interface pins are configured on the STM, or does that happen at an earlier point?&amp;nbsp;It is not uncommon to see a small glitch on the bus lines when it is being initialized and this glitch may be read as an invalid packet by the receiver. The usual way to mitigate this is to enable the internal pull up on the RX line. Maybe you can try that.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1672912254139v1.png" alt=" " /&gt;&lt;/p&gt;
[quote user="pressure_sensor_nonconn_adv"]And what is the difference between&amp;nbsp;&lt;span&gt;NRFX_UART_ENABLED and&amp;nbsp;UART_ENABLED?&lt;/span&gt;[/quote]
&lt;p&gt;This can be a bit confusing, but you should ignore the NRFX_* symbols when you use the nrf_drv_* driver APIs with the legacy layer.&amp;nbsp; Please refer to the &amp;quot;&lt;a title="Migration guide for nrfx drivers" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/nrfx_migration_user_guide.html?cp=8_1_2_7"&gt;Migration guide for nrfx drivers&lt;/a&gt;&amp;quot;&amp;nbsp;for more details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Configuration in DFU nRF52840</title><link>https://devzone.nordicsemi.com/thread/403245?ContentTypeID=1</link><pubDate>Wed, 04 Jan 2023 17:35:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8980110d-b8fd-4f53-bc62-45bf074ad5d5</guid><dc:creator>pressure_sensor_nonconn_adv</dc:creator><description>&lt;p&gt;Thank you for the prompt reply!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My pin assignments and init function are the following:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define RX_PIN_NUMBER_MDBT50Q  	8	    /**&amp;lt; UART RX pin number.  */
#define TX_PIN_NUMBER_MDBT50Q  	6       /**&amp;lt; UART TX pin number.  */
#define CTS_PIN_NUMBER_MDBT50Q 	7       /**&amp;lt; UART CTS pin number. */
#define RTS_PIN_NUMBER_MDBT50Q 	5      /**&amp;lt; UART RTS pin number. */

UINT32_T UART_DFU_Mng_TransportInit(nrf_dfu_observer_t observer)
{
   ERROR_T ERROR_RetVal = E_OK;
   ret_code_t err_code = NRF_SUCCESS;

   BOOL_ProcessingDone = TRUE;


   if (BOOL_IsActive)
   {
      return err_code;
   }

//   NRF_LOG_DEBUG(&amp;quot;serial_dfu_transport_init()&amp;quot;);

   m_observer = observer;

   m_serial.rsp_func           = UART_DFU_Mng_ResponseSend;
   m_serial.payload_free_func  = UART_DFU_Mng_PayloadFree;
   m_serial.mtu                = UART_SERIALPRTC_MTU;
   m_serial.p_rsp_buf          = &amp;amp;m_rsp_buf[NRF_UART_MAX_RESPONSE_SIZE_SERIALPRTC -
                                            NRF_SERIAL_MAX_RESPONSE_SIZE];
   m_serial.p_low_level_transport = &amp;amp;m_uart_dfu_transport;

   nrf_drv_uart_config_t uart_config = NRF_DRV_UART_DEFAULT_CONFIG;

   uart_config.pselrxd   = RX_PIN_NUMBER_MDBT50Q;
   uart_config.pseltxd   = TX_PIN_NUMBER_MDBT50Q;
   uart_config.pselcts   = CTS_PIN_NUMBER_MDBT50Q;
   uart_config.pselrts   = RTS_PIN_NUMBER_MDBT50Q;

   uart_config.hwfc      = NRF_DFU_SERIAL_UART_USES_HWFC ?
         NRF_UART_HWFC_ENABLED : NRF_UART_HWFC_DISABLED;
   uart_config.p_context = &amp;amp;m_serial;

   NRF_LOG_ERROR(&amp;quot;nrf_drv_uart_init&amp;quot;);


   err_code =  nrf_drv_uart_init(&amp;amp;m_uart, &amp;amp;uart_config, UART_DFU_Mng_EventHandler);
   if (err_code != NRF_SUCCESS)
   {
      NRF_LOG_ERROR(&amp;quot;UART_DFU_Mng_TransportInit Failed initializing uart %d&amp;quot;, err_code);
      return err_code;
   }

   err_code = nrf_drv_uart_rx(&amp;amp;m_uart, &amp;amp;UINT8_RxByte, 1);
   if (err_code != NRF_SUCCESS)
   {
//      NRF_LOG_ERROR(&amp;quot;Failed initializing rx&amp;quot;);
   }

//   NRF_LOG_DEBUG(&amp;quot;serial_dfu_transport_init() completed&amp;quot;);

   BOOL_IsActive = true;

   if (m_observer)
   {
      m_observer(NRF_DFU_EVT_TRANSPORT_ACTIVATED);
   }

//todo enable dfu notify send, here or redefine nrf_dfu_init_user(), or send from app

   if(FALSE == _BOOL_SysEvtSent)
   {
      _BOOL_SysEvtSent = TRUE;
      ERROR_Check(ERROR_RetVal, UART_DFU_Mng_SysEventDfuNotify());
   }

   return err_code;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/scheme.jpeg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The error only shows up once the update/transfer from the STM32H7 is started.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/95146/uart-configuration-in-dfu-nrf52840/402297"]The main difference is that UARTE has easyDMA support. However, it does not make much of a difference for the UART DFU transport as it only allocates 1 byte for its DMA buffer.[/quote]
&lt;p&gt;And what is the difference between&amp;nbsp;&lt;span&gt;NRFX_UART_ENABLED and&amp;nbsp;UART_ENABLED?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Once the App is running on the nRF and STM32 uC somehow the USART communication seems to be working. So it must be something BL specific on uC or nRF side.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Configuration in DFU nRF52840</title><link>https://devzone.nordicsemi.com/thread/402297?ContentTypeID=1</link><pubDate>Tue, 27 Dec 2022 13:44:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6fb42cd-d502-412f-a077-7fa33abfb939</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]Is there specific requirements for DMA or similar when switching to the nRF52840? eg I have seen this line in&amp;nbsp;nrf_drv_uart_init:[/quote]
&lt;p&gt;The 52840 has 2x UARTE instances and one UART instance instead of 1x UARTE and 1x UART like on the 52832. The assert is simply to warn users if they try to use UART1 which does not exist.&amp;nbsp;&lt;/p&gt;
[quote user=""]What exactly is the difference between&amp;nbsp;NRFX_UART(E)_ENABLED and&amp;nbsp;UART_ENABLED?[/quote]
&lt;p&gt;The main difference is that UARTE has easyDMA support. However, it does not make much of a difference for the UART DFU transport as it only allocates 1 byte for its DMA buffer.&lt;/p&gt;
[quote user=""]when should I use&amp;nbsp;UART_LEGACY_SUPPORT?[/quote]
&lt;p&gt;I cannot think of any reasons for using the UART_LEGACY_SUPPORT (i.e. use UART instead of UARTE). The reason we included the UART peripheral in the first place was to ease porting of existing code from the nRF51 series (&lt;a title="Migrating from the nRF51 Series to the nRF52 Series" href="https://infocenter.nordicsemi.com/topic/migration_nrf52/MIG/nrf52_migration/preface.html?cp=4_8"&gt;Migrating from the nRF51 Series to the nRF52 Series&lt;/a&gt;)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1672148394548v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Can you include&amp;nbsp;your UART&amp;nbsp;pin assignments? Also, is the&amp;nbsp;NRF_DRV_UART_EVT_ERROR event raised before or after the transfer is started?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>