<?xml-stylesheet type="text/xsl" href="https://community.element14.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/"><channel><title>VHDL design for ROHM Heart Rate sensor BH1790 - try i2c</title><link>/technologies/fpga-group/b/blog/posts/vhdl-design-for-rohm-heart-rate-sensor-bh1790</link><description>I&amp;#39;m going to try and run an i2c design in VHDL fabric. For self-training.The target device is the Rohm BH1790 optical heart rate sensor. It&amp;#39;s a device where the i2c protocol is straightforward but strict. A good candidate for training - a RTL state m</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: VHDL design for ROHM Heart Rate sensor BH1790 - try i2c</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/vhdl-design-for-rohm-heart-rate-sensor-bh1790</link><pubDate>Sun, 06 Feb 2022 19:02:17 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7b94a60e-264a-44fc-9d0e-5da97c612079</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;what I&amp;#39;m fighting with at the moment:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I try to implement the SCL and SDA&amp;nbsp;with 3-state and pull-ups.&lt;br /&gt;However, the Zynq seems to pull them to 0 when I assign a &amp;#39;Z&amp;#39;.&lt;br /&gt;I first suspected my logic (I still do). So I just set a pin hard &amp;#39;Z&amp;#39; always. It still pulls the output to 0, even if I use a strong 1K pull-up.&lt;br /&gt;Investigating ...&amp;nbsp;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=22845&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: VHDL design for ROHM Heart Rate sensor BH1790 - try i2c</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/vhdl-design-for-rohm-heart-rate-sensor-bh1790</link><pubDate>Sat, 05 Feb 2022 10:16:47 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7b94a60e-264a-44fc-9d0e-5da97c612079</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I used VHDL Style Guide (VSG) to report&amp;nbsp;and clean my code.&amp;nbsp;It required two manual steps to comply.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;img src="/resized-image/__size/1280x720/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-7b94a60e-264a-44fc-9d0e-5da97c612079/pastedimage1644055714581v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Most rules could be automatically fixed. After that first auto-fix, I&amp;nbsp;had to manually resolve these:&lt;/p&gt;
&lt;p&gt;&lt;img height="203" src="/resized-image/__size/1732x406/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-7b94a60e-264a-44fc-9d0e-5da97c612079/pastedimage1644055893184v2.png" width="866" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Once that was done, over to formatting warnings that needed manual resolve. All were code lines that exceeded 120 characters:&lt;/p&gt;
&lt;p&gt;&lt;img height="468" src="/resized-image/__size/1810x936/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-7b94a60e-264a-44fc-9d0e-5da97c612079/pastedimage1644056008866v3.png" width="905" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;After going trough the code and breaking up the lines (it were all comments at the end of lines), I got a pass:&lt;/p&gt;
&lt;p&gt;&lt;img height="156" src="/resized-image/__size/1478x312/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-7b94a60e-264a-44fc-9d0e-5da97c612079/pastedimage1644056098435v4.png" width="739" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Resulting code (not functional yet, this is to show how the style across the source file is now consistent:&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:f0e34b89-5576-4930-928e-8871ba9e0fcc:type=text&amp;text=%0D%0Alibrary%20ieee%3B%0D%0A%20%20use%20ieee.std_logic_1164.all%3B%0D%0A%20%20use%20ieee.std_logic_unsigned.all%3B%0D%0A%20%20use%20ieee.numeric_std.all%3B%0D%0A%0D%0Aentity%20bh1790%20is%0D%0A%20%20generic%20%28%0D%0A%20%20%20%20input_clk%20%20%20%20%20%20%3A%20integer%20%3A%3D%2050_000_000%3B%20--%20input%20clock%20speed%20from%20user%20logic%20in%20Hz%0D%0A%20%20%20%20sampling_count%20%3A%20integer%20%3A%3D%2032%3B%20%20%20%20%20%20%20%20%20--%20sampling%20count%0D%0A%20%20%20%20--%20samples%20are%20grouped%20by%20this%20count%0D%0A%20%20%20%20--%20%28once%20I%20implement%20it%29%0D%0A%20%20%20%20sampling_frequency%20%3A%20integer%20%3A%3D%2032%20%20%20%20%20%20--%20sampling%20frequency%20in%20Hz%0D%0A%20%20%29%3B%0D%0A%20%20port%20%28%0D%0A%20%20%20%20clk%20%20%20%20%20%3A%20in%20%20%20%20std_logic%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20system%20clock%0D%0A%20%20%20%20reset_n%20%3A%20in%20%20%20%20std_logic%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20active%20low%20reset%0D%0A%20%20%20%20--%20data%20interface%0D%0A%20%20%20%20data_out%20%3A%20out%20%20%20std_logic_vector%2831%20downto%200%29%3B%20%20%20%20%20%20--%2032%20bit%20raw%20sensor%20data%0D%0A%20%20%20%20--%20%5B1%5D%5B0%5D%5B3%5D%5B2%5D%20-%20%5B0x5500%5D%5B0x5400%5D%5B0x5700%5D%5B0x5600%5D%0D%0A%20%20%20%20--%20%5Bledoff%20data%5D%5Bledon%20data%5D%0D%0A%20%20%20%20debug_register%20%3A%20out%20%20%20std_logic_vector%287%20downto%200%29%3B%20--%20to%20remove.%208%20pins%20to%20validate%0D%0A%20%20%20%20--%20internal%20statuses%2C%20clocks%2C%20...%0D%0A%20%20%20%20--%20connections%20to%20i2c%20driver%0D%0A%20%20%20%20ena%20%20%20%20%20%20%20%3A%20out%20%20%20std_logic%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20latch%20in%20command%0D%0A%20%20%20%20addr%20%20%20%20%20%20%3A%20out%20%20%20std_logic_vector%286%20downto%200%29%3B%20%20%20%20%20%20--%20address%20of%20target%20slave%0D%0A%20%20%20%20rw%20%20%20%20%20%20%20%20%3A%20out%20%20%20std_logic%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%27%200%27%20is%20write%2C%20%271%27%20is%20read%0D%0A%20%20%20%20data_wr%20%20%20%3A%20out%20%20%20std_logic_vector%287%20downto%200%29%3B%20%20%20%20%20%20--%20data%20to%20write%20to%20slave%0D%0A%20%20%20%20busy%20%20%20%20%20%20%3A%20in%20%20%20%20std_logic%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20indicates%20transaction%20in%20progress%0D%0A%20%20%20%20data_rd%20%20%20%3A%20in%20%20%20%20std_logic_vector%287%20downto%200%29%3B%20%20%20%20%20%20--%20data%20read%20from%20slave%0D%0A%20%20%20%20ack_error%20%3A%20in%20%20%20%20std_logic%0D%0A%20%20%29%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20flag%20if%20improper%20acknowledge%20from%20slave%0D%0Aend%20entity%20bh1790%3B%0D%0A%0D%0Aarchitecture%20bh1790%20of%20bh1790%20is%0D%0A%0D%0A%20%20constant%20divider%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3A%20integer%20%3A%3D%20%28input_clk%20%2F%20sampling_frequency%29%3B%0D%0A%20%20constant%20bh1790glc_device_address%20%3A%20std_logic_vector%286%20downto%200%29%20%3A%3D%20%28b%221011011%22%29%3B%20--%207bit%20Addrss%205B%0D%0A%0D%0A%20%20type%20machine_state%20is%20%28reset%2C%20init%2C%20active%2C%20communicate%2C%20comms_done%29%3B%20--%20needed%20states%0D%0A%0D%0A%20%20signal%20s_debug_register%20%3A%20std_logic_vector%287%20downto%200%29%3B%0D%0A%20%20signal%20state%20%20%20%20%20%20%20%20%20%20%20%20%3A%20machine_state%3B%0D%0A%0D%0A%20%20signal%20busy_prev%20%20%20%20%20%3A%20std_logic%3B%0D%0A%20%20signal%20data_to_write%20%3A%20std_logic_vector%287%20downto%200%29%3B%0D%0A%20%20signal%20data_read%20%20%20%20%20%3A%20std_logic_vector%287%20downto%200%29%3B%0D%0A%0D%0A%20%20procedure%20i2c_commands%20%28%0D%0A%20%20%20%20init%20%3A%20in%20STD_LOGIC%29%20is%20--%20if%20init%2C%20the%20reset%20command%20will%20be%20added.%20In%20that%20case%2C%20mandatory%20wait%201%2F32%20second%0D%0A%20%20begin%0D%0A%0D%0A%20%20%20%20--%20todo%3A%20write%20the%20i2c%20registers.%0D%0A%20%20%20%20if%20%28init%20%3D%20%271%27%29%20then%20--%20only%20reset%20during%20initialisation.%0D%0A%20%20%20%20%20%20--%20reset%20register%0D%0A%20%20%20%20end%20if%3B%0D%0A%0D%0A%20%20%20%20--%20register%201%2C%202%2C%203%2C%20refresh%20always%20as%20advised%20by%20datasheet%0D%0A%0D%0A%20%20end%20i2c_commands%3B%0D%0A%0D%0Abegin%0D%0A%0D%0A%20%20clocked%20%3A%20process%20%28clk%2C%20reset_n%29%20is%0D%0A%0D%0A%20%20%20%20variable%20sample_clock_count%20%3A%20integer%20RANGE%200%20to%20divider%3B%20%20--%20timing%20for%20clock%20generation%0D%0A%20%20%20%20variable%20samples_count%20%20%20%20%20%20%3A%20integer%20range%200%20to%20sampling_count%3B%0D%0A%20%20%20%20variable%20busy_cnt%20%20%20%20%20%20%20%20%20%20%20%3A%20integer%20range%200%20to%205%3B%0D%0A%0D%0A%20%20begin%0D%0A%0D%0A%20%20%20%20if%20%28reset_n%20%3D%20%270%27%29%20then%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20reset%20asserted%0D%0A%20%20%20%20%20%20state%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%3D%20reset%3B%0D%0A%20%20%20%20%20%20sample_clock_count%20%20%20%20%20%20%20%20%20%20%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20samples_count%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20s_debug_register%287%20downto%200%29%20%3C%3D%20%28others%20%3D%3E%20%270%27%29%3B%20%20%20%20%20%20%20%20%20%20--%20debug%3A%20reset%20status%0D%0A%20%20%20%20elsif%20%28clk%27event%20and%20clk%20%3D%20%271%27%29%20then%0D%0A%20%20%20%20%20%20s_debug_register%280%29%20%3C%3D%20%271%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20todo%20remove%20debug%3A%20reset%20status%0D%0A%20%20%20%20%20%20sample_clock_count%20%20%3A%3D%20sample_clock_count%20%2B%201%3B%20%20%20%20%20%20%20%20%20%20%20%20--%20continue%20clock%20generation%20timing%0D%0A%20%20%20%20%20%20if%20%28sample_clock_count%20%3D%20divider%29%20then%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20do%20every%20sample%20frequency%20tick%0D%0A%20%20%20%20%20%20%20%20s_debug_register%281%29%20%3C%3D%20not%20s_debug_register%281%29%3B%20%20%20%20%20%20%20%20%20--%20todo%20remove%20debug%3A%20toggle%20each%20time%0D%0A%0D%0A%20%20%20%20%20%20%20%20case%20state%20is%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20when%20reset%20%3D%3E%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20i2c_commands%28%271%27%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20state%20%3C%3D%20communicate%3B%0D%0A%20%20%20%20%20%20%20%20%20%20when%20communicate%20%3D%3E%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20busy_prev%20%3C%3D%20busy%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20capture%20the%20value%20of%20the%20previous%20i2c%20busy%20signal%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20%28busy_prev%20%3D%20%270%27%20AND%20busy%20%3D%20%271%27%29%20then%20%20%20%20%20%20%20%20%20%20%20%20--%20i2c%20busy%20just%20went%20high%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20busy_cnt%20%3A%3D%20busy_cnt%20%2B%201%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20counts%20the%20times%20busy%20has%20gone%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20from%20low%20to%20high%20during%20transaction%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20end%20if%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20case%20busy_cnt%20is%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20busy_cnt%20keeps%20track%20of%20which%20command%20we%20are%20on%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20when%200%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20no%20command%20latched%20in%20yet%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ena%20%20%20%20%20%3C%3D%20%271%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20initiate%20the%20transaction%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20addr%20%20%20%20%3C%3D%20bh1790glc_device_address%3B%20%20%20%20%20%20%20%20%20%20%20%20--%20set%20the%20address%20of%20the%20slave%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rw%20%20%20%20%20%20%3C%3D%20%270%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20command%201%20is%20a%20write%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20data_wr%20%3C%3D%20data_to_write%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20data%20to%20be%20written%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20when%201%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%201st%20busy%20high%3A%20command%201%20latched%2C%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20okay%20to%20issue%20command%202%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rw%20%3C%3D%20%271%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20command%202%20is%20a%20read%20%28addr%20stays%20the%20same%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20when%202%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%202nd%20busy%20high%3A%20command%202%20latched%2C%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20okay%20to%20issue%20command%203%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rw%20%3C%3D%20%270%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20command%203%20is%20a%20write%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%20%20%20%20%20data_wr%20%3C%3D%20new_data_to_write%3B%20%20%20%20%20%20%20%20%20%20%20--data%20to%20be%20written%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%20%20%20%20%20IF%28busy%20%3D%20%270%27%29%20THEN%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--indicates%20data%20read%20in%20command%202%20is%20ready%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%20%20%20%20%20%20%20data%2815%20DOWNTO%208%29%20%3C%3D%20data_rd%3B%20%20%20%20%20%20%20%20%20--retrieve%20data%20from%20command%202%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%20%20%20%20%20END%20IF%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%20%20%20WHEN%203%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--3rd%20busy%20high%3A%20command%203%20latched%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20okay%20to%20issue%20command%204%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%20%20%20%20%20rw%20%3C%3D%20%271%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--command%204%20is%20read%20%28addr%20stays%20the%20same%29%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%20%20%20WHEN%204%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--4th%20busy%20high%3A%20command%204%20latched%2C%20ready%20to%20stop%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ena%20%3C%3D%20%270%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20deassert%20enable%20to%20stop%20transaction%20after%20command%204%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20%28busy%20%3D%20%270%27%29%20then%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20indicates%20data%20read%20in%20command%204%20is%20ready%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20data_read%287%20DOWNTO%200%29%20%3C%3D%20data_rd%3B%20%20%20%20%20%20%20%20%20%20%20%20%20--%20retrieve%20data%20from%20command%204%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20busy_cnt%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3A%3D%200%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20reset%20busy_cnt%20for%20next%20transaction%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20state%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%3D%20comms_done%3B%20%20%20%20%20%20%20%20%20%20--%20transaction%20complete%2C%20go%20to%20next%20state%20in%20design%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20end%20if%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20when%20OTHERS%20%3D%3E%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20NULL%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20end%20case%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20when%20others%20%3D%3E%0D%0A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20--%20there%20should%20be%20no%20default%20handling%0D%0A%0D%0A%20%20%20%20%20%20%20%20end%20case%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20sample_clock_count%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20%20%20samples_count%20%20%20%20%20%20%3A%3D%20samples_count%20%2B%201%3B%0D%0A%20%20%20%20%20%20%20%20if%20%28samples_count%20%3D%20sampling_count%29%20then%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20do%20every%20sampling_count%20sample%20tick%0D%0A%20%20%20%20%20%20%20%20%20%20s_debug_register%282%29%20%3C%3D%20%271%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20todo%20remove%0D%0A%20%20%20%20%20%20%20%20%20%20samples_count%20%20%20%20%20%20%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20%20%20else%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20do%20every%20sample%20tick%20except%20on%0D%0A%20%20%20%20%20%20%20%20%20%20--%20the%20sampling_count%27st%20sample%0D%0A%20%20%20%20%20%20%20%20%20%20s_debug_register%282%29%20%3C%3D%20%270%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20todo%20remove%0D%0A%20%20%20%20%20%20%20%20end%20if%3B%0D%0A%20%20%20%20%20%20end%20if%3B%0D%0A%20%20%20%20end%20if%3B%0D%0A%0D%0A%20%20end%20process%20clocked%3B%0D%0A%0D%0A%20%20--%20WHEN%20get_data%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--state%20for%20conducting%20this%20transaction%0D%0A%20%20--%20%20busy_prev%20%3C%3D%20i2c_busy%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--capture%20the%20value%20of%20the%20previous%20i2c%20busy%20signal%0D%0A%20%20--%20%20IF%28busy_prev%20%3D%20%270%27%20AND%20i2c_busy%20%3D%20%271%27%29%20THEN%20%20--i2c%20busy%20just%20went%20high%0D%0A%20%20--%20%20%20%20busy_cnt%20%3A%3D%20busy_cnt%20%2B%201%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--counts%20the%20times%20busy%20has%20gone%20from%20low%20to%20high%20during%20transaction%0D%0A%20%20--%20%20END%20IF%3B%0D%0A%20%20--%20%20CASE%20busy_cnt%20IS%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--busy_cnt%20keeps%20track%20of%20which%20command%20we%20are%20on%0D%0A%20%20--%20%20%20%20WHEN%200%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--no%20command%20latched%20in%20yet%0D%0A%20%20--%20%20%20%20%20%20i2c_ena%20%3C%3D%20%271%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--initiate%20the%20transaction%0D%0A%20%20--%20%20%20%20%20%20i2c_addr%20%3C%3D%20slave_addr%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--set%20the%20address%20of%20the%20slave%0D%0A%20%20--%20%20%20%20%20%20i2c_rw%20%3C%3D%20%270%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--command%201%20is%20a%20write%0D%0A%20%20--%20%20%20%20%20%20i2c_data_wr%20%3C%3D%20data_to_write%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20--data%20to%20be%20written%0D%0A%20%20--%20%20%20%20WHEN%201%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--1st%20busy%20high%3A%20command%201%20latched%2C%20okay%20to%20issue%20command%202%0D%0A%20%20--%20%20%20%20%20%20i2c_rw%20%3C%3D%20%271%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--command%202%20is%20a%20read%20%28addr%20stays%20the%20same%29%0D%0A%20%20--%20%20%20%20WHEN%202%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--2nd%20busy%20high%3A%20command%202%20latched%2C%20okay%20to%20issue%20command%203%0D%0A%20%20--%20%20%20%20%20%20i2c_rw%20%3C%3D%20%270%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--command%203%20is%20a%20write%0D%0A%20%20--%20%20%20%20%20%20i2c_data_wr%20%3C%3D%20new_data_to_write%3B%20%20%20%20%20%20%20%20%20%20--data%20to%20be%20written%0D%0A%20%20--%20%20%20%20%20%20IF%28i2c_busy%20%3D%20%270%27%29%20THEN%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--indicates%20data%20read%20in%20command%202%20is%20ready%0D%0A%20%20--%20%20%20%20%20%20%20%20data%2815%20DOWNTO%208%29%20%3C%3D%20i2c_data_rd%3B%20%20%20%20%20%20%20%20%20%20--retrieve%20data%20from%20command%202%0D%0A%20%20--%20%20%20%20%20%20END%20IF%3B%0D%0A%20%20--%20%20%20%20WHEN%203%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--3rd%20busy%20high%3A%20command%203%20latched%2C%20okay%20to%20issue%20command%204%0D%0A%20%20--%20%20%20%20%20%20i2c_rw%20%3C%3D%20%271%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--command%204%20is%20read%20%28addr%20stays%20the%20same%29%0D%0A%20%20--%20%20%20%20WHEN%204%20%3D%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--4th%20busy%20high%3A%20command%204%20latched%2C%20ready%20to%20stop%0D%0A%20%20--%20%20%20%20%20%20i2c_ena%20%3C%3D%20%270%27%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--deassert%20enable%20to%20stop%20transaction%20after%20command%204%0D%0A%20%20--%20%20%20%20%20%20IF%28i2c_busy%20%3D%20%270%27%29%20THEN%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--indicates%20data%20read%20in%20command%204%20is%20ready%0D%0A%20%20--%20%20%20%20%20%20%20%20data%287%20DOWNTO%200%29%20%3C%3D%20i2c_data_rd%3B%20%20%20%20%20%20%20%20%20%20%20--retrieve%20data%20from%20command%204%0D%0A%20%20--%20%20%20%20%20%20%20%20busy_cnt%20%3A%3D%200%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--reset%20busy_cnt%20for%20next%20transaction%0D%0A%20%20--%20%20%20%20%20%20%20%20state%20%3C%3D%20home%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--transaction%20complete%2C%20go%20to%20next%20state%20in%20design%0D%0A%20%20--%20%20%20%20%20%20END%20IF%3B%0D%0A%20%20--%20%20%20%20WHEN%20OTHERS%20%3D%3E%20NULL%3B%0D%0A%20%20--%20%20END%20CASE%3B%0D%0A%0D%0A%20%20debug_register%20%287%20downto%200%29%20%3C%3D%20s_debug_register%20%287%20downto%200%29%3B%0D%0A%0D%0Aend%20architecture%20bh1790%3B%0D%0A]&lt;/p&gt;
&lt;p&gt;If you see inconsistencies: flag them. We can then check if a custom rule can be added...&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=22845&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: VHDL design for ROHM Heart Rate sensor BH1790 - try i2c</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/vhdl-design-for-rohm-heart-rate-sensor-bh1790</link><pubDate>Thu, 27 Jan 2022 13:42:37 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7b94a60e-264a-44fc-9d0e-5da97c612079</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;A rudimentary 1st stab at the state machine for the BH1790 VHDL block:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:4612cf3d-fe86-4ba9-a920-adff645fb8d9:type=text&amp;text=LIBRARY%20ieee%3B%0D%0AUSE%20ieee.std_logic_1164.all%3B%0D%0AUSE%20ieee.std_logic_unsigned.all%3B%0D%0Ause%20ieee.numeric_std.all%3B%0D%0A%0D%0AENTITY%20bh1790%20IS%0D%0A%20%20GENERIC%28%0D%0A%20%20%20%20input_clk%20%3A%20INTEGER%20%3A%3D%2050_000_000%3B%20%20%20--input%20clock%20speed%20from%20user%20logic%20in%20Hz%0D%0A%20%20%20%20sampling_count%20%20%20%3A%20INTEGER%20%3A%3D%2032%3B%20%20%20%20--sampling%20count%20-%20samples%20are%20grouped%20by%20this%20count%20%28one%20I%20implement%20it%29%0D%0A%20%20%20%20sampling_frequency%20%3A%20integer%20%3A%3D%2032%29%3B%20--%20sampling%20frequency%20in%20Hz%0D%0A%20%20PORT%28%0D%0A%20%20%20%20clk%20%20%20%20%20%20%20%3A%20IN%20%20%20%20%20STD_LOGIC%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--system%20clock%0D%0A%20%20%20%20reset_n%20%20%20%3A%20IN%20%20%20%20%20STD_LOGIC%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--active%20low%20reset%0D%0A%20%20%20%20--%20data%20interface%0D%0A%20%20%20%20data_out%20%20%3A%20OUT%20%20%20%20std_logic_vector%2831%20downto%200%29%3B--%2032%20bit%20raw%20sensor%20data%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%5B1%5D%5B0%5D%5B3%5D%5B2%5D%20-%20%5B0x5500%5D%5B0x5400%5D%5B0x5700%5D%5B0x5600%5D%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20%5Bledoff%20data%5D%5Bledon%20data%5D%0D%0A%20%20%20%20debug_register%20%3A%20out%20std_logic_vector%287%20downto%200%29%3B%20--%20to%20remove.%208%20pins%20to%20validate%20internal%20statuses%2C%20clocks%2C%20...%0D%0A%20%20%20%20--%20connections%20to%20i2c%20driver%0D%0A%20%20%20%20ena%20%20%20%20%20%20%20%3A%20OUT%20%20%20%20STD_LOGIC%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--latch%20in%20command%0D%0A%20%20%20%20addr%20%20%20%20%20%20%3A%20OUT%20%20%20%20STD_LOGIC_VECTOR%286%20DOWNTO%200%29%3B%20--address%20of%20target%20slave%0D%0A%20%20%20%20rw%20%20%20%20%20%20%20%20%3A%20OUT%20%20%20%20STD_LOGIC%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%270%27%20is%20write%2C%20%271%27%20is%20read%0D%0A%20%20%20%20data_wr%20%20%20%3A%20OUT%20%20%20%20STD_LOGIC_VECTOR%287%20DOWNTO%200%29%3B%20--data%20to%20write%20to%20slave%0D%0A%20%20%20%20busy%20%20%20%20%20%20%3A%20IN%20%20%20%20%20STD_LOGIC%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--indicates%20transaction%20in%20progress%0D%0A%20%20%20%20data_rd%20%20%20%3A%20IN%20%20%20%20%20STD_LOGIC_VECTOR%287%20DOWNTO%200%29%3B%20--data%20read%20from%20slave%0D%0A%20%20%20%20ack_error%20%3A%20IN%20%20%20%20%20STD_LOGIC%29%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--flag%20if%20improper%20acknowledge%20from%20slave%0D%0AEND%20bh1790%3B%0D%0A%0D%0AARCHITECTURE%20bh1790%20OF%20bh1790%20IS%0D%0A%20%20CONSTANT%20divider%20%20%3A%20%20INTEGER%20%3A%3D%20%28input_clk%2Fsampling_frequency%29%3B%20%0D%0A%20%20TYPE%20machine_state%20IS%20%28reset%2Cinit%2Cactive%29%3B%20--needed%20states%0D%0A%20%20signal%20s_debug_register%20%3A%20std_logic_vector%20%287%20downto%200%29%20%3A%3D%20%28others%20%3D%3E%20%270%27%29%3B%0D%0A%20%20signal%20state%20%3A%20machine_state%3B%0D%0A%20%20%0D%0Aprocedure%20i2c_commands%20%28%0D%0A%20init%20%3A%20in%20STD_LOGIC%29%20is%20--%20if%20init%2C%20the%20reset%20command%20will%20be%20added.%20In%20that%20case%2C%20mandatory%20wait%201%2F32%20second%0D%0Abegin%0D%0A%20%20--%20todo%3A%20write%20the%20i2c%20registers.%0D%0A%20%20if%20%28init%20%3D%20%271%27%29%20then%20%20%20--%20only%20reset%20during%20initialisation.%0D%0A%20%20%20%20--%20reset%20register%0D%0A%20%20end%20if%3B%20%0D%0A%20%20--%20register%201%2C%202%2C%203%2C%20refresh%20always%20as%20advised%20by%20datasheet%0D%0Aend%20i2c_commands%3B%20%0D%0A%20%20%0D%0ABEGIN%0D%0A%0D%0A%20%20PROCESS%28clk%2C%20reset_n%29%0D%0A%20%20%20%20VARIABLE%20sample_clock_count%20%20%3A%20%20INTEGER%20RANGE%200%20TO%20divider%3B%20%20--timing%20for%20clock%20generation%0D%0A%20%20%20%20VARIABLE%20samples_count%20%3A%20integer%20range%200%20to%20sampling_count%3B%0D%0A%20%20%20%20%0D%0A%20%20BEGIN%0D%0A%20%20%20%20IF%28reset_n%20%3D%20%270%27%29%20THEN%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--reset%20asserted%0D%0A%20%20%20%20%20%20state%20%3C%3D%20reset%3B%0D%0A%20%20%20%20%20%20sample_clock_count%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20samples_count%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20s_debug_register%287%20downto%200%29%20%3C%3D%20%28others%20%3D%3E%20%270%27%29%3B%20--%20debug%3A%20reset%20status%0D%0A%20%20%20%20ELSIF%28rising_edge%28clk%29%29%20THEN%0D%0A%20%20%20%20%20%20%20%20s_debug_register%280%29%20%3C%3D%20%271%27%3B%20--%20todo%20remove%20debug%3A%20reset%20status%0D%0A%20%20%20%20%20%20%20%20sample_clock_count%20%3A%3D%20sample_clock_count%20%2B%201%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20--continue%20clock%20generation%20timing%0D%0A%20%20%20%20%20%20%20%20if%20%28sample_clock_count%20%3D%20divider%29%20then%20--%20do%20every%20sample%20frequency%20tick%0D%0A%20%20%20%20%20%20%20%20%20%20s_debug_register%281%29%20%3C%3D%20not%20s_debug_register%281%29%3B%20--%20todo%20remove%20debug%3A%20toggle%20each%20time%0D%0A%20%20%20%20%20%20%20%20%20%20case%20%20state%20is%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20when%20reset%20%3D%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20i2c_commands%28%271%27%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20when%20others%20%3D%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20--%20there%20should%20be%20no%20default%20handling%0D%0A%20%20%20%20%20%20%20%20%20%20end%20case%3B%0D%0A%20%20%20%20%20%20%20%20%20%20sample_clock_count%20%3A%3D%200%3B%0D%0A%20%20%20%20%20%20%20%20%20%20samples_count%20%3A%3D%20samples_count%20%2B%201%3B%0D%0A%20%20%20%20%20%20%20%20%20%20if%20%28samples_count%20%3D%20sampling_count%29%20then%20--%20do%20every%20sampling_count%20sample%20tick%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20s_debug_register%282%29%20%3C%3D%20%271%27%3B%20--%20todo%20remove%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20samples_count%20%3A%3D%200%3B%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20else%20--%20do%20every%20sample%20tick%20except%20on%20the%20sampling_count%27st%20sample%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20s_debug_register%282%29%20%3C%3D%20%270%27%3B%20--%20todo%20remove%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20end%20if%3B%0D%0A%20%20%20%20%20%20%20%20end%20if%3B%0D%0A%20%20%20%20END%20IF%3B%0D%0A%20%20END%20PROCESS%3B%20%20%0D%0A%0D%0A%20%20debug_register%20%287%20downto%200%29%20%3C%3D%20s_debug_register%20%287%20downto%200%29%3B%0D%0A%20%20%0D%0A%20%20END%20bh1790%3B]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Not functional at all, but you can start to sense how the object flow will work.&lt;br /&gt;Some VHDL constructs used:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;overridable generic for clock frequency, desired sample&amp;nbsp;frequency and desired sample count for grouping, filtering and calculation&lt;/li&gt;
&lt;li&gt;a procedure, with 1 input parameter&lt;/li&gt;
&lt;li&gt;state machine with CASE and&amp;nbsp;a custom&amp;nbsp;TYPE for the states&lt;/li&gt;
&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=22845&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: VHDL design for ROHM Heart Rate sensor BH1790 - try i2c</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/vhdl-design-for-rohm-heart-rate-sensor-bh1790</link><pubDate>Sun, 23 Jan 2022 18:09:56 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7b94a60e-264a-44fc-9d0e-5da97c612079</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;The BH1790 IP has some logic now. Just enough to verify if I have the initial timing right.&lt;br /&gt;I&amp;#39;ve attached scope signals&amp;nbsp;reset (channel 3), the internal sample clock (channel 1, 32 Hz requested) and a checkpoint&amp;nbsp;that should fire&amp;nbsp;32 samples (channel B, 32 samples at 32 Hz: should fire every second.&lt;/p&gt;
&lt;p&gt;I have a 32 Hz timer, that will be used to clock the samples. Each tick, I&amp;#39;ll request the i2c module to fetch a record.&lt;br /&gt;At this moment, the sample code toggles an output pin. As result the output frequency should be requested / 2 = 16 Hz.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/1280x720/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-7b94a60e-264a-44fc-9d0e-5da97c612079/pastedimage1642960857861v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;look at the measured frequency at the bottom of the screen, not the one indicated by the cursors (the right cursor is not exactly on the falling edge).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The second channel should bump once exactly every second. That&amp;#39;s when - later&amp;nbsp;- the heartbeats per second will be calculated based on 32 samples.&lt;br /&gt;The test pulse is based on the derived 32 Hz clock. Later, this will become a calculation.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/1280x720/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-7b94a60e-264a-44fc-9d0e-5da97c612079/pastedimage1642961212153v5.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In this case, both frequency and cursor show the match.&lt;/p&gt;
&lt;p&gt;With this test bed, I know that my code&amp;nbsp;has the right impulses to take a measurement every 1/32th second. And that it has the right impulse to do aggregation at each 32th measurement.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=22845&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: VHDL design for ROHM Heart Rate sensor BH1790 - try i2c</title><link>https://community.element14.com/technologies/fpga-group/b/blog/posts/vhdl-design-for-rohm-heart-rate-sensor-bh1790</link><pubDate>Sun, 23 Jan 2022 13:31:17 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7b94a60e-264a-44fc-9d0e-5da97c612079</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Progress:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I made an IP that represents the BH1790, and connected it to the i2c driver.&lt;br /&gt;Because driver and IC work closely together, I put them on a hierarchy diagram. They will represent a single simple block on the main block diagram.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The hierarchy diagram for IC + i2c Driver:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/1280x720/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-7b94a60e-264a-44fc-9d0e-5da97c612079/pastedimage1642944560965v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The top level:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/1280x720/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-7b94a60e-264a-44fc-9d0e-5da97c612079/pastedimage1642944463759v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The bh1790_sensor RTL is doing nothing at the moment. I focused on getting the interfaces and connecting blocks.&lt;br /&gt;My next action is to&amp;nbsp;derive an internal 32 Hz clock inside the IC driver, and try to push the init sequence to i2c...&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=22845&amp;AppID=19&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>