SPI device (MCP3204) in CODESYS Control for BeagleBone SL

laruso
2021-03-31
2021-04-01
  • ojz0r - 2021-04-01

    I feel with you, i had the same frustration with getting the MCP3208 working.
    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).
    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.

     
  • laruso - 2021-04-01

    @ ojz0r: Thanks for your offer to help me out.

    After spending several hours checking the code, the only missing thing was to enable/pinmux the SPI in the device (BeagleBone Black)

    I did:
    - changed the library 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.
    - changed the device description according to the already given MCP3008 (available as a package over CODESYS Forge), to fulfill the needs of the MCP3204.

    After all you can insert a MCP3204 and the map your variables in the register for I/O mapping of the device.
    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

     

    Last edit: laruso 2021-05-19
    • Ingo

      Ingo - 2021-04-01

      Good to hear that!

      While I can't help technically, as I don't have those devices here in use,
      I am always willing to help in creating a project on Forge.

      If you have problems, let me know!

       

Log in to post a comment.