<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to SPI device (MCP3204) in CODESYS Control for BeagleBone SL</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/da04f8ac8b/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/da04f8ac8b/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/da04f8ac8b/</id><updated>2021-04-01T16:09:57.344000Z</updated><subtitle>Recent posts to SPI device (MCP3204) in CODESYS Control for BeagleBone SL</subtitle><entry><title>SPI device (MCP3204) in CODESYS Control for BeagleBone SL</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/da04f8ac8b/?limit=25#1731" rel="alternate"/><published>2021-04-01T16:09:57.344000Z</published><updated>2021-04-01T16:09:57.344000Z</updated><author><name>laruso</name><uri>https://forge.codesys.com/u/laruso/</uri></author><id>https://forge.codesys.com099f0a65d440f4b37d7cfd452cb4b1d1262f279c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;@ ojz0r: Thanks for your offer to help me out.&lt;/p&gt;
&lt;p&gt;After spending several hours checking the code, the only missing thing was to enable/pinmux the SPI in the device (BeagleBone Black)&lt;/p&gt;
&lt;p&gt;I did:&lt;br/&gt;
- &lt;strong&gt;changed the library&lt;/strong&gt; according to the already given MCP3008 (available as a package over CODESYS Forge) and the MCP3202 (thread "Raspberry Pi: List of available drivers / libraries" in CODESYS forum), to fulfill the needs of the MCP3204. In the library code I did (as usual) documented the relevant code by comments.&lt;br/&gt;
- &lt;strong&gt;changed the device description&lt;/strong&gt; according to the already given MCP3008 (available as a package over CODESYS Forge), to fulfill the needs of the MCP3204.&lt;/p&gt;
&lt;p&gt;After all you can insert a MCP3204 and the map your variables in the register for I/O mapping of the device.&lt;br/&gt;
Attached are the library and the device description. If there is any time I#ll put it on CODESYS Forge, because I really want to see to make those efforts and results to be accessible and available as clear as possible&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>SPI device (MCP3204) in CODESYS Control for BeagleBone SL</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/da04f8ac8b/?limit=25#277b" rel="alternate"/><published>2021-04-01T08:07:05.259000Z</published><updated>2021-04-01T08:07:05.259000Z</updated><author><name>ojz0r</name><uri>https://forge.codesys.com/u/ojz0r/</uri></author><id>https://forge.codesys.combaf51692cf06b4ef192db0d4039d70b2787843d7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I feel with you, i had the same frustration with getting the MCP3208 working.&lt;br/&gt;
However i finally cracked it and when you know how to use the SPI function it is really easy to modify however you want (the opcodes for various SPI slaves are different).&lt;br/&gt;
Unfortunately im at work now and the example code is in my private pc at home so i wont be able to post it until tonight to give you a little pointers on what to modify to get it working with the MCP3204.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>SPI device (MCP3204) in CODESYS Control for BeagleBone SL</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/da04f8ac8b/?limit=25#5354" rel="alternate"/><published>2021-03-31T17:05:22.609000Z</published><updated>2021-03-31T17:05:22.609000Z</updated><author><name>laruso</name><uri>https://forge.codesys.com/u/laruso/</uri></author><id>https://forge.codesys.comda3e62d87b1b8cd9a711e2c1a36b57502d296c7d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I want to implement the ADC IC &lt;strong&gt;MCP3204&lt;/strong&gt; in &lt;strong&gt;CODESYS Control for BeagleBone SL&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;(Preconditions: already operational attached CAN cape for analog input and CAN bus manager and device)&lt;/p&gt;
&lt;p&gt;After searching and reading for 8 hours, I couldn't get it. I'm relatively new to CODESYS, but familiar with "package manager" and "library repository". What I have and what I've done:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Project and info from Erwin Schwellinger: &lt;a href="https://forge.codesys.com/forge/talk/Runtime/thread/39c439b0c2/?page=2&amp;amp;limit=25#e953"&gt;https://forge.codesys.com/forge/talk/Runtime/thread/39c439b0c2/?page=2&amp;amp;limit=25#e953&lt;/a&gt;&lt;br/&gt;
  (but MCP3008 used)&lt;/li&gt;
&lt;li&gt;Info about the need of a specific device information &lt;br/&gt;
  (but don't know how to make it; no development environment in use)&lt;/li&gt;
&lt;li&gt;Checked several forums/topics/threads&lt;/li&gt;
&lt;li&gt;MCP3008 &lt;a href="https://forge.codesys.com/drv/mcp3008/home/Home/"&gt;https://forge.codesys.com/drv/mcp3008/home/Home/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;MCP3008 Lib to MCP3208 &lt;a href="https://forge.codesys.com/forge/talk/Runtime/thread/9112cbdb0a/"&gt;https://forge.codesys.com/forge/talk/Runtime/thread/9112cbdb0a/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;MCP3202 &lt;a href="https://forge.codesys.com/forge/talk/Runtime/thread/8981ce928a/#5807"&gt;https://forge.codesys.com/forge/talk/Runtime/thread/8981ce928a/#5807&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;CODESYS packages from Hubo &lt;a href="https://ftl-auerbach.lima-city.de/Hubo/download-pages/codesys-package/" rel="nofollow"&gt;https://ftl-auerbach.lima-city.de/Hubo/download-pages/codesys-package/&lt;/a&gt; (struggled with not download able libraries)&lt;/li&gt;
&lt;li&gt;checked the empty CODESYS Forge project &lt;a href="https://forge.codesys.com/drv/mcp3208/code/"&gt;https://forge.codesys.com/drv/mcp3208/code/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Still got no result. Can anybody give me (exact instructions) in how to get a working device, or provide a working library and device description, please?&lt;/p&gt;
&lt;p&gt;In the meantime I grabbed:&lt;br/&gt;
- the package "MCP3008" from CODESYS Forge &lt;a href="https://forge.codesys.com/drv/mcp3008/home/Home/"&gt;https://forge.codesys.com/drv/mcp3008/home/Home/&lt;/a&gt;&lt;br/&gt;
- and the library and device description for "MCP3202" &lt;a href="https://forge.codesys.com/forge/talk/Runtime/thread/9112cbdb0a/"&gt;https://forge.codesys.com/forge/talk/Runtime/thread/9112cbdb0a/&lt;/a&gt;&lt;br/&gt;
and adapted the code of the MCP3008 to (hopefully) MCP3204 for both, the library and the device description. &lt;/p&gt;
&lt;p&gt;After doing the changes I installed the library and the device description to the corresponding repositories, added the device "SPI master" (and for testing purposes "SPI master (test version)"; but without success), and attached the (newly own created) device "MCP3204".&lt;/p&gt;
&lt;p&gt;In the configuration for the SPI master, I tried first with the default entry "'/dev/spidev0.0'" (and _diMode = 0, _diBitsPerWord = 8 and _diMaxSpeed = 1000000; as seen in sample project posted from Erwin Schwellinger &lt;a href="https://forge.codesys.com/forge/talk/Runtime/thread/39c439b0c2/?page=2&amp;amp;limit=25#e953"&gt;https://forge.codesys.com/forge/talk/Runtime/thread/39c439b0c2/?page=2&amp;amp;limit=25#e953&lt;/a&gt;), but SPI master wouldn't run with still red warning sign. With "'/dev/spidev0.1'" same. &lt;br/&gt;
With "'/dev/spidev1.0'", "'/dev/spidev1.1'", "'/dev/spidev2.0'", "'/dev/spidev2.1'", it's getting me the green sign on the SPI master. So far so good. &lt;/p&gt;
&lt;p&gt;Next step was to map variables, that are being read in program to be actualized. But at the end I get stuck with not getting any values other than 0.&lt;/p&gt;
&lt;p&gt;Any constructive help is welcome. Hopefully this can help others, getting from similar code samples to working new SPI devices.&lt;br/&gt;
The actual archived project file is attached.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>