<?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>SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length</link><description>I am struggling with the same requirement as this ticket : 
 ie receive from a UARTE without knowing in advance how many rx bytes to expect. This is typical for exchanging AT type commands on a UART with another system...the receiver doesn&amp;#39;t know how</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Jul 2024 10:43:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length" /><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/494099?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2024 10:43:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05c108b3-c326-4d67-96ad-bd129369c1b7</guid><dc:creator>BrianW</dc:creator><description>&lt;p&gt;ok, thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/494076?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2024 09:03:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5574260-66b1-42b3-b685-6863e2fabc20</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Unfortunately, I have not been able to find any resources for interfacing with smartcards following the ISO 7816 standard with our chips. Please create a new support ticket if you encounter any problems with getting this to work, as I will be out of the office starting next week.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/493190?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 13:54:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73a433f9-a0de-4d9a-a50b-2489f3b22a0f</guid><dc:creator>BrianW</dc:creator><description>&lt;p&gt;One of my UART instances is intended to talk to a ISO7816 smartcard :-)&lt;/p&gt;
&lt;p&gt;The setup for this UART looks it will be fairly customised and definitely different from the AT command exchanges on the other 2 anyway...&lt;/p&gt;
&lt;p&gt;I&amp;#39;m hoping this will work for a basic IOS7816-3 communication (T=0 or T=1), if not it may be more of a bit-bang solution... Any pointers to a example of this operation on a nrf gratefully received!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/493180?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 13:38:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51f223bb-55ee-4d84-a8fc-366198509e1e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m glad to hear that you may be able to work around this by sharing the same peripheral ID. If possible, it might be easier to share an instance between SPIM and TWIM instead of UART. If all UART instances are going to be used for receiving AT commands, it&amp;nbsp;might be&amp;nbsp;beneficial for them to have the same implementation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/493174?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 13:19:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e6e9419-3157-4a79-8e1f-9d151557c43b</guid><dc:creator>BrianW</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length/492964"]&lt;strong&gt;Edit 2: &lt;/strong&gt;The&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.6.1/page/zephyr/samples/boards/nrf/nrfx_prs/README.html"&gt;nrfx peripheral resource sharing example&lt;/a&gt;&amp;nbsp;demonstrates how you can use shared peripherals with the nrfx drivers.[/quote]
&lt;p&gt;Excellent, I should be able to time share between one of my UARTs and the epaper SPIM...&lt;/p&gt;
&lt;p&gt;Thanks!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492964?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2024 12:39:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9828674-de27-479f-8969-1a02688b8fd8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I understand it&amp;#39;s for AT commands, but with the async implementation, it seems like you should not&amp;nbsp;have to worry about varying packet lengths.&amp;nbsp;&lt;/p&gt;
[quote user="BrianW"]Ok. So it needs to use a general SPI peripheral on the app core to talk to the nrf7002 then? (since the QSPI is going to be used for the flash - there is only 1 QSPI peripheral on the nRF5340, yes?)[/quote]
&lt;p&gt;Yes, there is only one QSPI peripheral on the device, so it looks like you will be missing one serial peripheral&amp;nbsp;if you only use the app core.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: I forgot to add that, depending on the use case, you may be able to use one instance for both SPIM and TWIM. The Zephyr drivers do not support this, but it is possible with the nrfx driver.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit 2: &lt;/strong&gt;The&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.6.1/page/zephyr/samples/boards/nrf/nrfx_prs/README.html"&gt;nrfx peripheral resource sharing example&lt;/a&gt;&amp;nbsp;demonstrates how you can use shared peripherals with the nrfx drivers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492796?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2024 16:19:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70315214-6daa-4a9e-a091-8aa2ff0da0b5</guid><dc:creator>BrianW</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length/492780"]I don&amp;#39;t see the benefit of using the interrupt-driven API over the async API. A third option is to use the nRFX UARTE driver directly if the zephyr drivers don&amp;#39;t meet your requirements.[/quote]
&lt;p&gt;As I said, its for a &amp;#39;AT command&amp;#39; type exchange:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;ie receive from a UARTE &lt;strong&gt;without knowing in advance how many rx bytes to expect.&lt;/strong&gt; This is typical for exchanging AT type commands on a UART with another system...the receiver doesn&amp;#39;t know how long the command being sent is going to be.&amp;nbsp;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The end of each block is determined by a CRLF, not by a fixed size.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The nrfx UARTE api has the same issue - no event for the RX until the receive buffer is full...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hence the typical rx function is exactly like the UART echo example you pointed me towards : check each rx byte and trigger treatment of the line when you see a CR/LF...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I guess the zephyr interrupt api is implemented as a 1 byte rx buffer, to get an interrupt per byte...&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length/492780"]The Wifi stack runs on the application core,[/quote]
&lt;p&gt;Ok. So it needs to use a general SPI peripheral on the app core to talk to the nrf7002 then? (since the QSPI is going to be used for the flash - there is only 1 QSPI peripheral on the nRF5340, yes?)&lt;/p&gt;
&lt;p&gt;I&amp;#39;m now going to be lacking a serial type peripheral... (3 UART+1TWIM+2 SPI+1 QSPI)....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492780?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2024 15:29:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2a19b85-a296-4e8d-b45b-eb212d933ba1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I don&amp;#39;t see the benefit of using the interrupt-driven API over the async API. A third option is to use the nRFX UARTE driver directly if the zephyr drivers don&amp;#39;t meet your requirements.&lt;/p&gt;
[quote userid="134465" url="~/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length/492774"]Any guidance on this one? I haven&amp;#39;t started on the wifi operation yet (we are just at PCB schema and component selection...)[/quote]
&lt;p&gt;The Wifi stack runs on the application core, and there are specific&amp;nbsp;pins which are dedicated to the QSPI, see&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/qspi.html#ariaid-title2"&gt;https://docs.nordicsemi.com/bundle/ps_nrf5340/page/qspi.html#ariaid-title2&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492774?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2024 15:10:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6662e7f6-2414-4a63-a151-23fa1135215c</guid><dc:creator>BrianW</dc:creator><description>&lt;p&gt;&lt;em&gt;The QSPI is completely indepentent and does not share peripheral ID with any of the other peripherals&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Ok, thanks.&amp;nbsp;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length/492718"]Unfortunately, I don&amp;#39;t think you will be able to achieve reliable reception with 3 UART instances running concurrently when you don&amp;#39;t have HWFC. The async API mitigates this problem as it can work with larger DMA buffers and double-buffering.&amp;nbsp;[/quote]
&lt;p&gt;Ok...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is there an api call (zephyr or nrfx-uarte) that allows the application to make the easydma switch to the 2nd buffer without aborting it? This would at least let me check for received data before the buffer is full, without potentially stopping the uarte in the middle of a character....&lt;/p&gt;
[quote userid="134465" url="~/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length/492692"]- when using the wifi nRF7002 chip, does this use the SPI peripheral on the NET processor? (and hence does not use up one of the peripherals on the APP processor...)[/quote]
&lt;p&gt;Any guidance on this one? I haven&amp;#39;t started on the wifi operation yet (we are just at PCB schema and component selection...)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492718?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2024 13:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6883b37c-0f8c-48e7-9566-92cf53069b2e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The QSPI is completely indepentent and does not share peripheral ID with any of the other peripherals&lt;/p&gt;
[quote userid="134465" url="~/f/nordic-q-a/112756/sdconnect-on-nrf5340-using-uarte-with-unknown-rx-length/492692"]&lt;p&gt;I was not planning to use hardward flow control : do you have an idea at what baud rate it would be neccessary (using the interrupt-driven api)?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Unfortunately, I don&amp;#39;t think you will be able to achieve reliable reception with 3 UART instances running concurrently when you don&amp;#39;t have HWFC. The async API mitigates this problem as it can work with larger DMA buffers and double-buffering.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492692?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2024 12:25:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61511a49-dea9-4b51-8f52-af6883d8ef0e</guid><dc:creator>BrianW</dc:creator><description>&lt;p&gt;I was not planning to use hardward flow control : do you have an idea at what baud rate it would be neccessary (using the interrupt-driven api)?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;On the &amp;#39;peripheral shared id&amp;#39; question :&lt;/p&gt;
&lt;p&gt;- the QSPI peripheral for the flash is independant of SPIs 0-4, yes?&lt;/p&gt;
&lt;p&gt;- when using the wifi nRF7002 chip, does this use the SPI peripheral on the NET processor? (and hence does not use up one of the peripherals on the APP processor...)&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492615?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2024 07:38:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e264765-a590-4543-95ba-24118788eda0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Brian,&lt;/p&gt;
&lt;p&gt;Yes, you can use the interrupt-driven API on the nRF53. Usage of this API is demonstrated by the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/samples/drivers/uart/echo_bot/README.html"&gt;UART echo&lt;/a&gt;&amp;nbsp;sample (zephyr/samples/drivers/uart/echo_bot/). You can enable all UART instances with this driver as long as you make sure to not enable other peripherals which share ID with your UARTE instances (&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/peripheral_interface.html#ariaid-title3"&gt;Peripherals with shared ID&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Peripherals sharing ID with UARTE2&lt;/strong&gt;&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/pastedimage1720424136857v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/chapters/memory/appmem.html#ariaid-title3"&gt;https://docs.nordicsemi.com/bundle/ps_nrf5340/page/chapters/memory/appmem.html#ariaid-title3&lt;/a&gt;&lt;/p&gt;
[quote user="BrianW"]how (non)efficient is this mode compared to &amp;#39;asynchronous API&amp;#39; mode? (in terms of CPU overhead at a specific baud rate when the data is arriving at that rate (ie no idle periods)[/quote]
&lt;p&gt;There is some more overhead since it uses smaller DMA buffers, but it&amp;#39;s usually not notiecable as long as you use hardware flow control. Without hardware flow control, you will may need to use the async API to acheive reliable reception.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492526?ContentTypeID=1</link><pubDate>Fri, 05 Jul 2024 18:32:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af338e73-473f-4b7e-8436-0b7611e5d4ba</guid><dc:creator>BrianW</dc:creator><description>&lt;p&gt;Thanks for the info.&lt;/p&gt;
&lt;p&gt;Looking then at&amp;nbsp;the Zephyr system uart driver implementation&amp;nbsp; (as per the link):&lt;/p&gt;
&lt;p&gt;- can I&amp;nbsp;use it in&amp;nbsp; &amp;#39;interrupt driven API&amp;#39; mode on an nRF5340?&lt;/p&gt;
&lt;p&gt;- is there a code example/sample of an application that uses this mode?&lt;/p&gt;
&lt;p&gt;- in this mode, how many UART devices can I open like this simultaneously? (ie does each instance use a resource like a TIMER/PPI to do its byte counting?)&lt;/p&gt;
&lt;p&gt;- how (non)efficient is this mode compared to &amp;#39;asynchronous API&amp;#39; mode? (in terms of CPU overhead at a specific baud rate when the data is arriving at that rate (ie no idle periods)&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;Brian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDConnect on nRF5340 : using UARTE with unknown rx length</title><link>https://devzone.nordicsemi.com/thread/492451?ContentTypeID=1</link><pubDate>Fri, 05 Jul 2024 12:29:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52c43d49-c89d-42c9-a87c-02c9f2f45316</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]Using an nRF5340, its seems my only option is to use SDKConnect with Zephyr, yes? No more SoftDevice builds?[/quote]
&lt;p&gt;This is correct. Instead of using the Softdevice which implements&amp;nbsp;the Bluetooth host and Bluetooth controller, we now have a Softdevice controller which typically reside on the network core, and the Zephyr host on the application. Communication between host and controller is through the standard HCI interface. You can read more about the architecture here:&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/device_guides/nrf53/features_nrf53.html#protocols_and_use_cases_for_the_nrf5340_dk"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/device_guides/nrf53/features_nrf53.html#protocols_and_use_cases_for_the_nrf5340_dk&lt;/a&gt;&lt;/p&gt;
[quote user=""]- do I understand correctly that the nrf5340 does NOT support basic UART, only UARTE? Only EasyDMA operation is possible (in the same way it doesn&amp;#39;t seem to support TWI, only TWIM)[/quote]
&lt;p&gt;Yes, the nRF5340 does not include the legacy serial peripherals without easyDMA.&lt;/p&gt;
[quote user=""]&lt;p&gt;- I have multiple UARTs to service - but if as per the final reply in the ticket above I have to use 2 timers per channel (one to count bytes received, one to do the &amp;#39;idle line&amp;#39; timeout) it seems I won&amp;#39;t have enough timers?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;The idle timeout timer is a Zephyr timer instance which runs off the system clock (RTC) . Byte counting with a TIMERs and PPI is optional, and is enabled through these Kconfig symbols:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/35aedfa532875b79524a00267cdaaa17ca3049f5/drivers/serial/Kconfig.nrfx#L82"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/35aedfa532875b79524a00267cdaaa17ca3049f5/drivers/serial/Kconfig.nrfx#L82&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/hardware/peripherals/uart.html"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/hardware/peripherals/uart.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>