<?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>I2C, I must be stupid.</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/88002/i2c-i-must-be-stupid</link><description>Am I the only one who finds Zephyrs I2C implementation a little cludgy? Or am I just missing something? 
 It may be that I&amp;#39;m just used to bare metal I2C but I can&amp;#39;t seem to figure out how I can send a few bytes, followed by 512 zero&amp;#39;s without allocating</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 18 May 2022 21:02:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/88002/i2c-i-must-be-stupid" /><item><title>RE: I2C, I must be stupid.</title><link>https://test-devzone.nordicsemi.com/thread/368470?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 21:02:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d7aa1e6-bad9-490c-8dcb-7d91b841e073</guid><dc:creator>user114729</dc:creator><description>&lt;p&gt;In my view, and yours may vary, an API that provides high level abstraction is better if it also provides some lower level functionality. Mainly because it&amp;#39;s never possible to envision every use case.&lt;/p&gt;
&lt;p&gt;I get the impression that i2c_transfer() is intended for this purpose, it has some flexibility.&amp;nbsp; If it had something like I2C_MSG_RAWBYTES as a flags option, that would just send the buffer on the bus without a start bit or address, then that would allow for just about any scenario, including mine.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;In this case, I&amp;#39;m clearing a small OLED screen and my workaround/compromise was to define a buffer with enough data to clear one line, then iterate. There&amp;#39;s a performance hit, but you don&amp;#39;t notice it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C, I must be stupid.</title><link>https://test-devzone.nordicsemi.com/thread/368325?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 11:56:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca4c1811-aa01-4b23-a824-78f26e37a93b</guid><dc:creator>user100109</dc:creator><description>[quote user="CASWA_PK"]Good question. It&amp;#39;s probably because I&amp;#39;ve come from a decade (or so) of developing on&amp;nbsp; 8 bit hardware and pulling 513 bytes off the stack seems like a dumb way to solve the problem?[/quote]
&lt;p style="line-height:100%;margin-bottom:0;" lang="en-GB"&gt;I understand. I would recommend you to give it a try and play a little around. If you have specific suggestions on how we can improve our software, you are of course welcome to report them to us :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C, I must be stupid.</title><link>https://test-devzone.nordicsemi.com/thread/368311?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 11:31:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a584922a-9d2f-453c-9603-b692690c951f</guid><dc:creator>user114729</dc:creator><description>&lt;p&gt;Good question. It&amp;#39;s probably because I&amp;#39;ve come from a decade (or so) of developing on&amp;nbsp; 8 bit hardware and pulling 513 bytes off the stack seems like a dumb way to solve the problem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C, I must be stupid.</title><link>https://test-devzone.nordicsemi.com/thread/368306?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 11:25:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:befc1e50-8e67-40aa-9d3d-ec1c67201c93</guid><dc:creator>user100109</dc:creator><description>[quote user="CASWA_PK"]&lt;p&gt;What I don&amp;#39;t want to do is&lt;br /&gt;uint8_t buffer[513];&lt;/p&gt;
&lt;p&gt;It&amp;#39;s not clear to me that this is possible? But I may just be looking at it wrong...&lt;/p&gt;[/quote]
&lt;p style="line-height:100%;margin-bottom:0;" lang="en-GB"&gt;Why would you not want to do that? The &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/peripherals/i2c.html#c.i2c_write"&gt;i2c_write()&lt;/a&gt; / &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/peripherals/i2c.html#c.i2c_transfer"&gt;i2c_transfer() &lt;/a&gt;API is designed to be assigned with a buffer and its size.&lt;br /&gt;&lt;br /&gt;Regards,&lt;/p&gt;
&lt;p style="line-height:100%;margin-bottom:0;" lang="en-GB"&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C, I must be stupid.</title><link>https://test-devzone.nordicsemi.com/thread/368262?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 09:54:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8543a121-406c-4d28-be89-b72ee44cb1d6</guid><dc:creator>user114729</dc:creator><description>&lt;p&gt;OK, I acknowledge that the scope of my question was a bit broad. Lets zoom in on an example:&lt;br /&gt;I want to send&amp;nbsp;&lt;/p&gt;
&lt;p&gt;0x40, 0x00, 0x00..... and another 509 of them to i2c address 25 in one transaction.&lt;br /&gt;&lt;br /&gt;What I don&amp;#39;t want to do is&lt;br /&gt;uint8_t buffer[513];&lt;/p&gt;
&lt;p&gt;It&amp;#39;s not clear to me that this is possible? But I may just be looking at it wrong...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C, I must be stupid.</title><link>https://test-devzone.nordicsemi.com/thread/368232?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 08:36:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf761f89-e2ca-443d-9451-05f8f12913b8</guid><dc:creator>user100109</dc:creator><description>&lt;p style="line-height:100%;margin-bottom:0;" lang="en-GB"&gt;Hello Paul,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]Am I the only one who finds Zephyrs I2C implementation a little cludgy? Or am I just missing something?[/quote]
&lt;p style="line-height:100%;margin-bottom:0;" lang="en-GB"&gt;Since the Zephyr RTOS contains a lot of functionality, higher complexity is almost given and finding a good entry point can be challenging. So no, you are not stupid. Confused maybe, but I can definitely feel you there :-)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]What I&amp;#39;m looking for is and i2c_write() that I can tell not to send an I2C_MSG_STOP....[/quote]
&lt;p style="line-height:100%;margin-bottom:0;" lang="en-GB"&gt;A good starting point should be the I2C API &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/peripherals/i2c.html#i2c"&gt;documentation&lt;/a&gt;. If the peripheral to use is configured correctly in the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/guides/dts/index.html#devicetree-guide"&gt;devicetree&lt;/a&gt; and enabled via &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/guides/dts/dt-vs-kconfig.html#devicetree-versus-kconfig"&gt;Kconfig&lt;/a&gt;, it should pretty much be straight forward to use functions like, &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/peripherals/i2c.html#c.i2c_write"&gt;i2c_write()&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You could also have a look at this &lt;a href="https://github.com/crfosse/ncs_projects/tree/main/peripheral_zephyr/i2c"&gt;example&lt;/a&gt; for your reference, demonstrating a simple use case.&lt;br /&gt;&lt;br /&gt;Regards,&lt;/p&gt;
&lt;p style="line-height:100%;margin-bottom:0;" lang="en-GB"&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>