Clear Filters
Clear Filters

Why does my device driver not work?

2 views (last 30 days)
Manuel Reimer
Manuel Reimer on 26 Dec 2020
Commented: Manuel Reimer on 1 Jan 2021
I want to create my own device driver Sink to drive custom external hardware.
I thought as a simple starting point it may be a good exercise to replicate an existing block (in my case the Servo block).
I did the best I can but for some reason just nothing happens on my Arduino Uno...
As I have no plan at all on how to debug, I don't even know where to start to find the reason.
Maybe someone could try this out. The servo data pin is meant to be attached to pin 9 on an Arduino Uno. My code is attached.

Answers (1)

Nikhil Sonavane
Nikhil Sonavane on 30 Dec 2020
You may refer to the following documentation and verify if you followed the same procedure-
  1 Comment
Manuel Reimer
Manuel Reimer on 1 Jan 2021
Thanks for your answer.
The tutorial is for MATLAB 2020 only. So some stuff like architecture detection differs significantly on older releases. After some hours of googling I found a possible solution for MATLAB 2019 which is the version I have to use.
Finally I found the missing stuff by using Simulink Coder to find out where the build settings differ with my self-made "Servo" block and the "official" Servo block in the Arduino Support package. I didn't find out where the magic happens with those build settings in the official Arduino support packages as this seems to be an MathWorks internal secret hidden in many useless P-Code files.
This is all very inconvenient. I have to use Simulink to directly program hardware in a project from my university which bases on the stuff shipped with the "Arduino Engineering Kit Revision 1". This works as long as you follow the textbook but documentation lacks heavily once you try to do something beyond the stuff that is prepared in existing support packages.
Why are the Arduino support packages for Simulink and Matlab not completely open sourced?? In my opinion this is heavily against the Arduino philosophy. The installed support package contains many "P-Code" files which can't be read and so can't be used to learn how your stuff actually has to be used for own projects. Your support package bases on open source Arduino libraries, so your own stuff can only be code that "glues" the open sourced stuff to the Simulink environment. By hiding this information you make it much more difficult to create own hardware support implementations!
From what I've learned so far, I think Simulink Hardware support is nice for universities to be used in control engineering laboratories, but I clearly wouldn't choose it for real projects.

Sign in to comment.


Find more on Arduino Hardware in Help Center and File Exchange





Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!