<?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>Stream data (file) over UART from a device to nRF52832, then send it to a peripheral using I2C</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c</link><description>Hello, 
 I have a peripheral that is connected to nRF52832 using I2C, in which I want to send some file to its memory. However, for sending this file, I need to stream it using UART for instance. 
 Question 1: How can I send a file without being entirely</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Jan 2021 10:18:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c" /><item><title>RE: Stream data (file) over UART from a device to nRF52832, then send it to a peripheral using I2C</title><link>https://devzone.nordicsemi.com/thread/289123?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 10:18:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2fca3d4-bd8a-418f-bb84-0e5642a5ea16</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Bakry"]&lt;blockquote&gt;&lt;div&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c/288865#288865"&gt;awneil said:&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Maybe you could simply use the UART flow control?&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;
&lt;p&gt;Where can I find it?&lt;/p&gt;[/quote]
&lt;p&gt;The UART(E) peripheral has a HW Flow Control feature. This is enabled&amp;nbsp;in the&amp;nbsp;&lt;a title="  CONFIG  " href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/uarte.html?cp=4_2_0_34_9_17#register.CONFIG"&gt;CONFIG&lt;/a&gt;&amp;nbsp;register (or through the driver in the application). Note that this is handled by HW, and may not be very flexible for this task. It may be simpler to send a request packet back&amp;nbsp;over UART to the file transmitting device when you are ready to receive a new packet.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="Bakry"]&lt;p&gt;1- How to send file over UART?&lt;/p&gt;
&lt;p&gt;2- How to break the file into chunks according to my application requirement?&lt;/p&gt;[/quote]
&lt;p&gt;Depends on what is supported by the device where the file is stored, but you could use Python with PySerial. See the code suggested in &lt;a href="https://stackoverflow.com/a/54929695"&gt;this post&lt;/a&gt;.&lt;/p&gt;
[quote user="Bakry"]3- How to send these received data to my I2C connected peripheral before receiving new data packet?[/quote]
&lt;p&gt;On the nRF-side, I would recommend that you configure either the UART driver (nrf_drv_uart/nrfx_uarte), or the libUARTE library for this task, instead of using the old app_uart library. The driver and libUART support reception of packets up to 255 bytes in a single buffer on nRF52832. app_uart only receives one byte at a time (and optionally stores this into a FIFO for later processing). Receiving larger chunks will reduce the work for the CPU, and reduce overall current consumption.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One the UART buffer is filled with a full packet, the event handler is called with information about the received packet. In this handler, you can&amp;nbsp;setup a TWI transfer to send the received chunk to the I2C device, and request a new chunk on the UART lines.&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: Stream data (file) over UART from a device to nRF52832, then send it to a peripheral using I2C</title><link>https://devzone.nordicsemi.com/thread/288870?ContentTypeID=1</link><pubDate>Wed, 13 Jan 2021 10:07:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4129487e-dba4-4c26-b754-3f4f936546e3</guid><dc:creator>Bakry</dc:creator><description>&lt;p&gt;Thank you for the fast response.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="6462" url="~/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c/288865#288865"]Maybe you could simply use the UART flow control?[/quote]
&lt;p&gt;Where can I find it?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, to simplify the procedure, I will break down the activities:&lt;/p&gt;
&lt;p&gt;1- How to send file over UART?&lt;/p&gt;
&lt;p&gt;2- How to break the file into chunks according to my application requirement?&lt;/p&gt;
&lt;p&gt;3- How to send these received data to my I2C connected peripheral before receiving new data packet?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stream data (file) over UART from a device to nRF52832, then send it to a peripheral using I2C</title><link>https://devzone.nordicsemi.com/thread/288865?ContentTypeID=1</link><pubDate>Wed, 13 Jan 2021 09:58:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c5ff707-9ea8-4451-8d2a-a50a6d6d0b54</guid><dc:creator>awneil</dc:creator><description>[quote userid="97754" url="~/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c/288862#288862"]How?[/quote]
&lt;p&gt;There is really nothing specific to nRF in this part - you have exactly the same requirement for sending &lt;em&gt;&lt;strong&gt;any&lt;/strong&gt; &lt;/em&gt;data to &lt;em&gt;&lt;strong&gt;any&lt;/strong&gt;&lt;/em&gt; UART.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s going to depend on your application.&lt;/p&gt;
&lt;p&gt;Maybe you could simply use the UART flow control?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stream data (file) over UART from a device to nRF52832, then send it to a peripheral using I2C</title><link>https://devzone.nordicsemi.com/thread/288862?ContentTypeID=1</link><pubDate>Wed, 13 Jan 2021 09:54:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05d3cd66-1818-4bf5-bf34-8e72935d1eee</guid><dc:creator>Bakry</dc:creator><description>&lt;p&gt;Thanks for your reply.&lt;/p&gt;
[quote userid="6462" url="~/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c/288860#288860"]Where is this &amp;quot;file&amp;quot; located?&amp;nbsp; That will determine how to access it,&amp;nbsp; and hot to &lt;em&gt;send&lt;/em&gt; it.[/quote]
&lt;p&gt;File is saved on my PC.&amp;nbsp;&lt;/p&gt;
[quote userid="6462" url="~/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c/288860#288860"]&lt;p&gt;Send it in smaller chunks - aka &amp;quot;blocks&amp;quot; or &amp;quot;packets&amp;quot;.&lt;/p&gt;
&lt;p&gt;You will need some sort of protocol for the nRF to tell the sender when it is ready for more data ...&lt;/p&gt;[/quote]
&lt;p&gt;How? Is there an example in the SDK to follow or use?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stream data (file) over UART from a device to nRF52832, then send it to a peripheral using I2C</title><link>https://devzone.nordicsemi.com/thread/288860?ContentTypeID=1</link><pubDate>Wed, 13 Jan 2021 09:49:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:908c11c5-7645-462b-99db-bb8e49ecf361</guid><dc:creator>awneil</dc:creator><description>[quote userid="97754" url="~/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c"]I want to send some&amp;nbsp;file[/quote]
&lt;p&gt;Where is this &amp;quot;file&amp;quot; located?&amp;nbsp; That will determine how to access it,&amp;nbsp; and hot to &lt;em&gt;send&lt;/em&gt; it.&lt;/p&gt;
[quote userid="97754" url="~/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c"]I need to stream it using UART for instance[/quote]
&lt;p&gt;The nRF52 UART - like any other UART - neither knows nor cares anything about files: all it sees is &lt;em&gt;bytes&lt;/em&gt; arriving.&lt;/p&gt;
[quote userid="97754" url="~/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c"]How can I send a file without being entirely saved on&amp;nbsp;nRF52832 flash memory[/quote]
&lt;p&gt;Send it in smaller chunks - aka &amp;quot;blocks&amp;quot; or &amp;quot;packets&amp;quot;.&lt;/p&gt;
&lt;p&gt;You will need some sort of protocol for the nRF to tell the sender when it is ready for more data ...&lt;/p&gt;
[quote userid="97754" url="~/f/nordic-q-a/70414/stream-data-file-over-uart-from-a-device-to-nrf52832-then-send-it-to-a-peripheral-using-i2c"]&lt;p&gt;&lt;span&gt;Is it possible to send a packet once received over I2C?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Of course it is:&amp;nbsp; again, as far as the I2C is concerned, it&amp;#39;s all just bytes - where those bytes originated is irrelevant.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>