🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Cannot GET DAC to play sine wave on speaker on Core2

    Scheduled Pinned Locked Moved Lessons and Guides
    3 Posts 2 Posters 7.4k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N Offline
      nicenemo
      last edited by nicenemo

      Using UIFlow, I don't get the DAC to produce an audible sine wave on the internal speaker. What am I doing wrong? The speaker is not broken, it can play a wav file.
      0. Initialization

      1. I play a wav file from internal flash to confirm that the speaker is working.
      2. I initialize the Dac 0 to port 25. This should be connected to the speaker
      3. I start a sine wave on the DAC with a duration of 0, that should be infinite.
      4. A loop with some code to read and display the ToF sensor.
      5. The code to modify the frequency is omitted. I just want it to play 440 Hz for to sort out this problem. The loop code displays the sensor output changes, no problem there.

      I want to make a Theremin using 2 ToF sensors, the DAC and the internal speaker. PbHub is not working either but there is a bug report elsewhere for that.
      I also noticed I cannot set the speaker volume for the WAV? How to do that?
      Is that the problem?
      See screenshot below:

      0_1612985419639_Dac_not_outputting_sound2.png

      1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue
        last edited by

        Hello @nicenemo

        looking at the M5Core2 schematic I can see that the two GPIOs selectable in the Init dac0 in pin xx, GPIO25 and GPIO26, are only connected to the MBus but not to the internal speaker of the M5Core2. In contrast GPIO25 is connected to the internal speaker of M5Stack (Gray, Fire etc.). I have a feeling that the DAC blocks are only useable with the internal speaker in M5Stack but not with the one inside M5Core2.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        N 1 Reply Last reply Reply Quote 0
        • N Offline
          nicenemo @felmue
          last edited by

          @felmue Thanks! So then I can add an external speaker or stick a wire on it and use that as the antenna of an AM transmitter ;)
          like in this video: https://www.youtube.com/watch?v=lRXHd3HNzEo

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post