Welcome, Guest
Username: Password: Remember me

NOTE: This is a "Community" forum. Please be mindful that community members are here to help as part of a community effort. We therefore appreciate your effort in keeping this forum a happy place!

If you have a specific issue (e.g. hardware, failure) and want help from our support team, please use our tech support portal (Support menu - > Contact Us).
Thanks a lot of your help in making a better community.
  • Page:
  • 1
  • 2

TOPIC:

Arduino library to control the MiniSHARC using I2C 7 years 4 months ago #25297

  • haggismonster
  • haggismonster's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 18
I've written an Arduino library to control the MiniSHARC. For more information on the history of this, please refer to this thread for initial research by Mungam and me.

Here's the link to the code on Github: MiniSHARC Arduino library .

Features
  • Get/set current attenuation level (0 - 255)
  • Get/set current configuration (1 - 4)
  • Get/set/toggle mute status (on/off)
  • Detect/wait for MiniSHARC to initialize

The library contains a small demo showing how to use the features.

Known Issues
  • The library contains hard-coded I2C bus addresses that MAY differ from Sharc to Sharc. If this turns out to be a problem I'll write a little bit of code to detect the correct addresses automatically.

Wiring
It's pretty simple - just 3 wires:
  • Connect your Arduino's ground to pin 5 on the MiniSHARC VOL-FP header
  • Connect your Arduino's SDA pin to pin 1 of the MiniSHARC VOL-FP header
  • Connect your Arduino's SCL pin to pin 2 of the MiniSHARC VOL-FP header

That's it! Let me know if it works for you, if it doesn't, etc etc.

Cheers,
H.
The following user(s) said Thank You: devteam, Juoigâ, pos, Jim the Oldbie, slavka1010

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 7 years 4 months ago #25298

  • Jim the Oldbie
  • Jim the Oldbie's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 268
  • Thank you received: 81
Thanks a lot for your time and effort with this. I'm just getting into Arduino myself, and I'm sure this will be very interesting and useful.

-- Jim

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 7 years 4 months ago #25407

  • devteam
  • devteam's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9173
  • Thank you received: 1480
Couldn't agree more with Jim! Thanks much for your effort on this project!
miniDSP, building a DSP community one board at a time.

For any official support, please contact our technical support team directly @ support.minidsp.com/support/home

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 7 years 2 months ago #26194

  • haggismonster
  • haggismonster's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 18
I've got an interesting update. Here's the short version:

  • I received a brand new MiniSHARC late last week. Why? Long story.
  • It didn't work properly with this Arduino library.
  • The library would read the MiniSHARC's volume only once: at MiniSHARC boot.
  • Sending volume up/down commands from Arduino to MiniSHARC still worked, but the library was not receiving any volume updates from the MiniSHARC.
  • After debugging with my Saleae Logic analyzer , it transpires that the MiniSHARC firmware no longer sends volume status information to the VOL-FP in response to a "change volume" command. My old MiniSHARC firmware sends the response; my new MiniSHARC firmware does not. It doesn't matter if an Arduino or genuine VOL-FP is used, the result is the same. No volume updates in the new firmware.
  • In other words: since I wrote and published the Arduino library, the MiniSHARC firmware has been changed to disable volume status information responses.

I leave the reader to speculate as to why this might be. I'd truly welcome DevTeam's response to my findings. But first, here's the long version of those findings:

Old Firmware
Regardless of old or new firmware, the I2C byte sequence sent by the VOL-FP to the MiniSHARC to turn the volume up by .5dB is as follows:

3, 150, 0

The old behavior was for the MiniSHARC firmware to (a) turn up the volume and (b) send an I2C byte sequence in response:

6, 132, 110, 0, 10, 1

The third byte is the new/current volume.

Here's a capture from the I2C bus showing command and response using a VOL-FP with the old firmware:



New Firmware
Using a genuine VOL-FP to turn up the volume sends the same command as before: 3, 150, 1. However, there is no response from the new MiniSHARC firmware. This capture was taken off the new MiniSHARC's I2C bus on July 27, 2016:



Let me be clear: the volume level is adjusted as it should be, but there's no volume status being returned in the new firmware: it's been hobbled, which is most disappointing.

A note on MiniSHARC firmware
There's firmware and there's firmware, and on the MiniSHARC there are at least 2 firmwares: the one you download and install/update using the MiniSHARC plugin, and the built-in control firmware that we (the end user) can't easily update. I have already verified that I'm using the same audio firmware (2.18) that my old MiniSHARC is using. All of which to say: the volume status changes were made in firmware that isn't public and can't be (easily) changed by us.

Workaround
There is more than one way to skin a cat, as the saying goes. After some debugging I found a workaround that gives back the old functionality of the library with the new MiniSHARC firmware. I have my readout back again, just like before. However, I'm not making my method public until I learn more about the direction of future MiniSHARC firmware changes and the motivations behind this specific change.

Arduino Library
At the present time, the Arduino library is defunct. The firmware changes have broken it. Only my private copy works and it's staying private for now.

I have updated the Github repo to state the project is defunct, and I've included a link to this thread.

To the DevTeam
If I may ask a couple of questions please:

  • Is this a deliberate attempt to stop people reading the volume level from the MiniSHARC?
  • Is this a deliberate attempt to stop the Arduino library, or other open source integrations, from working with the MiniSHARC?
  • If I publish details on how to work around this issue, will the MiniSHARC firmware be updated to defeat my workaround?
  • Is there a way end users like me to easily update the firmware to revert this change?

Thanks,
C.

Please Log in or Create an account to join the conversation.

Last edit: by haggismonster.

Arduino library to control the MiniSHARC using I2C 7 years 2 months ago #26208

  • devteam
  • devteam's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9173
  • Thank you received: 1480
@ haggismonster,

Interesting indeed.. :-)

That's a bit of the issue when we forget that there are details happening internally that we need to communicate.. This project is a bit on the fringe here (i..e community backed project) and the engineers sometimes forget implications. :-)

So to answer your question, it's not a deliberate attempt at all. It's simply the fact that we forgot to warn the community that we did changes in the firmware as we do constantly in all our products to improve them over time. :-) Hoping this clarify.
Here is the lowdown from the engineers:

" We disabled the feedback of the Vol-FP on the increase and decrease command to have faster volume response

The following commands can be sent to get the Volume/ Preset/ Source status
Send: 02, 131
Reply: 06, 132, Vol*-0.5dB, Muted, Source, Preset
"

Hoping this info helps

DevTeam
miniDSP, building a DSP community one board at a time.

For any official support, please contact our technical support team directly @ support.minidsp.com/support/home

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 7 years 2 months ago #26209

  • haggismonster
  • haggismonster's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 18

@ haggismonster,

Interesting indeed.. :-)

That's a bit of the issue when we forget that there are details happening internally that we need to communicate.. This project is a bit on the fringe here (i..e community backed project) and the engineers sometimes forget implications. :-)

So to answer your question, it's not a deliberate attempt at all. It's simply the fact that we forgot to warn the community that we did changes in the firmware as we do constantly in all our products to improve them over time. :-) Hoping this clarify.
Here is the lowdown from the engineers:

" We disabled the feedback of the Vol-FP on the increase and decrease command to have faster volume response

The following commands can be sent to get the Volume/ Preset/ Source status
Send: 02, 131
Reply: 06, 132, Vol*-0.5dB, Muted, Source, Preset
"

Hoping this info helps

DevTeam


DevTeam,

Thank you so much for the response and reassurance. I had come to the conclusion it was deliberate because the *only* affected operation seemed to be volume control. For example, I was still seeing "06, 132, vol, mute, source, preset" when changing presets. I'll avoid jumping to conclusions in future! I owe you an apology for essentially accusing you guys of deliberately screwing this up!

My workaround was to send quite literally any command sequence; the MiniSHARC would respond with the volume information I required. The current build sends: 03, 137, 02. I'll move to 02, 131.

One last question if I may: would you be kind enough to share the byte sequence for toggling mute on/off? Currently I'm using an awful hack that i think emulates a remote IR command (that I programmed as mute):

char cmd1[] = { 9, 149, 135, 1, 0, 255, 2, 253, 246 };
char cmd2[] = { 5, 149, 131, 1, 0 };

I'd much prefer to do it properly, and while I may be able to brute force it (i.e. send sequences 00, 00 through 99, 999 and see if anything changes the mute status) , I don't know if that's an entirely safe operation!

I'll update the library to reflect the changes now.

Thanks,
C.

Please Log in or Create an account to join the conversation.

Last edit: by haggismonster.

Arduino library to control the MiniSHARC using I2C 7 years 2 months ago #26210

  • haggismonster
  • haggismonster's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 18
I've updated the Arduino library to incorporate engineering's advice regarding reading volume over I2C. github.com/h4gg1s/MiniSHARC-Arduino

If you'd be so kind as to share the mute codes, that would be amazing. Thanks!

Please Log in or Create an account to join the conversation.

Last edit: by haggismonster.

Arduino library to control the MiniSHARC using I2C 7 years 2 months ago #26215

  • haggismonster
  • haggismonster's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 18
Well, I'm a real numb nuts. If I'd bothered to check the MiniSHARC downloads page I'd have seen this:

Rev 1.8 / June 2016
- Including miniSHARC firmware rev 2.18 / upgrade to latest rev
- Log of change
PIC: Fix the Vol-FP speed of response


Not only that, but I got the version numbers wrong in my first post: my new MiniSHARC is running 2.18, whereas my old one is running 2.17.

Even worse, I talked some nonsense about 2 firmwares. Wrong, too.

DevTeam, sorry for accusing you of something that clearly wasn't the case . I jumped the gun, got basically everything wrong, then blamed you guys. Your polite and measured response to my rantings is noted and appreciated.

Please Log in or Create an account to join the conversation.

Last edit: by haggismonster.

Arduino library to control the MiniSHARC using I2C 6 years 8 months ago #30013

  • sismik11
  • sismik11's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 1
Hi haggismonster.
Great work. I have been looking for something like this for a long time.
I hope to be able to use it to display the Volume status.

I have a question:
When connecting the Arduino to the miniSHARC via I2C, is it still possible to use the VOL-FP? If yes this would mean that both the Arduino and the VOL-FP are connected to the miniSHARC at the same time sharing pins.

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 6 years 8 months ago #30027

  • haggismonster
  • haggismonster's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 18
I think that will be ok, although I'm not sure what happens when you put two devices with the same device ID on an I2C bus. There's certainly no harm in trying! You'll need to connect only SDA, SCL and GND to the Arduino. Hopefully it just works!

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 6 years 8 months ago #30030

  • sismik11
  • sismik11's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 1
Thank you for your reply.
I'll give it a try and keep you posted.

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 6 years 8 months ago #30066

  • sismik11
  • sismik11's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 1
Hi haggismonster.
I'm sorry to tell you that I'm having some problems with your code. Actually the problem is most likely my lack of Arduino experience :-(

This is what I have done:
I have downloaded your code from github.com/h4gg1s/MiniSHARC-Arduino . I'm trying to include the files in the arduino lybary.
I have put the header file here: C:\Program Files (x86)\Arduino\libraries\MiniSHARC-Arduino-master\minisharc.h but I don't think it work. What about a source (.cpp) file. Is it missing?
The 2 .ino files are located in: C:\Program Files (x86)\Arduino\libraries\MiniSHARC-Arduino-master\Examples\MiniSHARC-Arduino\MiniSHARC-Arduino.ino and C:\Program Files (x86)\Arduino\libraries\MiniSHARC-Arduino-master\Examples\minisharc\minisharc.ino

I have also tryed to include the library files by importing as zip file.

When I try to compile the code, I get a lot of "undefined reference to `MiniSHARC::" errors.

Hope ypu can find some time help me.
Thank you.

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 6 years 6 months ago #31035

  • jsheerin
  • jsheerin's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
sismik,
Generally the way to install Arduino libraries is to unzip the files and move the folder containing them to your Arduino/libraries directory, but it seems in this case you need to put all the files in the zip into the project folder that you write your sketch in. For example, I saved a copy of the example sketch and modified it to just show the volume. It compiled with a few warnings but seems to work on the board.

Haggismonster, thanks for the new toy to play with. However it doesn't connect to my miniSharc. It never initializes. Is this an issue with the hard coded address you mentioned?

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 6 years 6 months ago #31036

  • jsheerin
  • jsheerin's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
I think I got it to initialize by using the hex value of the last 4 numbers of my board's serial number, but then as soon as I call Sharc.printStatus() again, it falls back into waitForMiniSHARCToInitialize and never comes back out. I also tried changing the volume level, but when I connect to the miniSharc via USB the volume is unchanged.

Please Log in or Create an account to join the conversation.

Arduino library to control the MiniSHARC using I2C 5 years 8 months ago #34819

  • kbasbas
  • kbasbas's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 1
  • Thank you received: 0
Does this library also work with 2x4HD (ADSP-21489) or is there another solution?

I wish that functionality such as configuration selection was supported natively by the MiniDSP team. Some pins to select source/configuration and guideline for I2C communication would have been great.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: devteam