5 Replies Latest reply on Jan 22, 2017 8:31 AM by bennnn

    GPIO pinmode 1 in mraa code?

    bennnn

      Hi , I would like to set in C/C++ MRAA gpio pins 40,41,42,43 to pinmode1 for I2S on intel edison.

       

      MRAA37  GPIO 40   J19-10  SSP2_CLK

      MRAA51  GPIO 41   J20-10  SSP2_FS

      MRAA50  GPIO 42   J20-9    SSP2_RXD

      MRAA38  GPIO 43   J19-11  SSP2_TXD

       

      how do I set these pins to pinmode1 ?

       

      PIN_FAST_GPIO  ? This intel edison table on this page says I need to set GPIO to pinmode1

       

      mraa: Intel Edison

       

      I'm sure I'm overlooking something very obvious here !

       

       

       

       

       

       

       

       

        • 1. Re: GPIO pinmode 1 in mraa code?
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello bennnn,
           
          Thanks for reaching out!
           
          As you can see in https://iotdk.intel.com/docs/master/mraa/, the functionalities of mraa are limited to GPIO, I2C, AIO, PWM, SPI and UART, therefore, Edison's I2S capabilities are not accessible through this library.
           
          If you'd like to use this interface, I'd suggest you to read Edison's Audio Setup Guide which can be found in http://www.intel.com/content/www/us/en/support/boards-and-kits/000005983.html.
           
          I hope this helps.
          -Peter.

          • 2. Re: GPIO pinmode 1 in mraa code?
            bennnn

            Hi Peter, makes sence mraa does'nt support the SSP on the SOC when I think about it !

             

            Is the ALSA dummy DPCM machine driver set to IO I2S audio on SSP2 by default ?

             

            The edison audio guide says I should look at to impliment a dummy machine driver, do I need a machine driver if I just want to

            IO i2S ? or maybe I should edit merr_dpcm_dummy.c to achieve this ?

             

            I get;

             

            root@edison:~# cd /linux/sound/soc/intel/board/

            -sh: cd: /linux/sound/soc/intel/board/: No such file or directory

             

            I can control my DSP device with I2C and I can have SD I2S or TDM IO from my DSP in slave mode, so the SSP2 port should work as is with arecord and aplay ?

             

            how do I setup the I2S or change to PCM so I can IO TDM etc ?

             

            if I run pactl list I get this list , is the dummy driver here?

             

            root@edison:~# pactl list

            Module #0

                Name: module-udev-detect

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "Detect available audio hardware and load matching drivers"

                    module.version = "6.0"

             

            Module #2

                Name: module-alsa-card

                Argument: device_id="0" name="0" card_name="alsa_card.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"

                Usage counter: 0

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "ALSA Card"

                    module.version = "6.0"

             

            Module #3

                Name: module-native-protocol-unix

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "Native protocol (UNIX sockets)"

                    module.version = "6.0"

             

            Module #4

                Name: module-bluetooth-policy

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Frédéric Dalleau"

                    module.description = "When a bluetooth sink or source is added, load module-loopback"

                    module.version = "6.0"

             

            Module #5

                Name: module-bluez5-discover

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "João Paulo Rechi Vita"

                    module.description = "Detect available BlueZ 5 Bluetooth audio devices and load BlueZ 5 Bluetooth audio drivers"

                    module.version = "6.0"

             

            Module #6

                Name: module-stream-restore

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "Automatically restore the volume/mute/device state of streams"

                    module.version = "6.0"

             

            Module #7

                Name: module-device-restore

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "Automatically restore the volume/mute state of devices"

                    module.version = "6.0"

             

            Module #8

                Name: module-default-device-restore

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "Automatically restore the default sink and source"

                    module.version = "6.0"

             

            Module #9

                Name: module-rescue-streams

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "When a sink/source is removed, try to move its streams to the default sink/source"

                    module.version = "6.0"

             

            Module #10

                Name: module-always-sink

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Colin Guthrie"

                    module.description = "Always keeps at least one sink loaded even if it's a null one"

                    module.version = "6.0"

             

            Module #11

                Name: module-suspend-on-idle

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "When a sink/source is idle for too long, suspend it"

                    module.version = "6.0"

             

            Module #12

                Name: module-position-event-sounds

                Argument:

                Usage counter: n/a

                Properties:

                    module.author = "Lennart Poettering"

                    module.description = "Position event sounds between L and R depending on the position on screen of the widget triggering them."

                    module.version = "6.0"

             

            Sink #0

                State: SUSPENDED

                Name: alsa_output.0.analog-stereo

                Description: Loopback Analog Stereo

                Driver: module-alsa-card.c

                Sample Specification: s16le 2ch 44100Hz

                Channel Map: front-left,front-right

                Owner Module: 2

                Mute: no

                Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB

                        balance 0.00

                Base Volume: 65536 / 100% / 0.00 dB

                Monitor Source: alsa_output.0.analog-stereo.monitor

                Latency: 0 usec, configured 0 usec

                Flags: HARDWARE HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY

                Properties:

                    alsa.resolution_bits = "16"

                    device.api = "alsa"

                    device.class = "sound"

                    alsa.class = "generic"

                    alsa.subclass = "generic-mix"

                    alsa.name = "Loopback PCM"

                    alsa.id = "Loopback PCM"

                    alsa.subdevice = "0"

                    alsa.subdevice_name = "subdevice #0"

                    alsa.device = "0"

                    alsa.card = "0"

                    alsa.card_name = "Loopback"

                    alsa.long_card_name = "Loopback 1"

                    device.bus_path = "/devices/virtual/sound/card0"

                    sysfs.path = "/devices/virtual/sound/card0"

                    device.string = "front:0"

                    device.buffering.buffer_size = "352800"

                    device.buffering.fragment_size = "352800"

                    device.access_mode = "mmap+timer"

                    device.profile.name = "analog-stereo"

                    device.profile.description = "Analog Stereo"

                    device.description = "Loopback Analog Stereo"

                    alsa.mixer_name = "Loopback Mixer"

                    module-udev-detect.discovered = "1"

                    device.icon_name = "audio-card"

                Ports:

                    analog-output: Analog Output (priority: 9900)

                Active Port: analog-output

                Formats:

                    pcm

             

            Source #0

                State: SUSPENDED

                Name: alsa_output.0.analog-stereo.monitor

                Description: Monitor of Loopback Analog Stereo

                Driver: module-alsa-card.c

                Sample Specification: s16le 2ch 44100Hz

                Channel Map: front-left,front-right

                Owner Module: 2

                Mute: no

                Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB

                        balance 0.00

                Base Volume: 65536 / 100% / 0.00 dB

                Monitor of Sink: alsa_output.0.analog-stereo

                Latency: 0 usec, configured 0 usec

                Flags: DECIBEL_VOLUME LATENCY

                Properties:

                    device.description = "Monitor of Loopback Analog Stereo"

                    device.class = "monitor"

                    alsa.card = "0"

                    alsa.card_name = "Loopback"

                    alsa.long_card_name = "Loopback 1"

                    device.bus_path = "/devices/virtual/sound/card0"

                    sysfs.path = "/devices/virtual/sound/card0"

                    device.string = "0"

                    module-udev-detect.discovered = "1"

                    device.icon_name = "audio-card"

                Formats:

                    pcm

             

            Source #1

                State: SUSPENDED

                Name: alsa_input.0.analog-stereo

                Description: Loopback Analog Stereo

                Driver: module-alsa-card.c

                Sample Specification: s16le 2ch 44100Hz

                Channel Map: front-left,front-right

                Owner Module: 2

                Mute: no

                Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB

                        balance 0.00

                Base Volume: 65536 / 100% / 0.00 dB

                Monitor of Sink: n/a

                Latency: 0 usec, configured 0 usec

                Flags: HARDWARE DECIBEL_VOLUME LATENCY

                Properties:

                    alsa.resolution_bits = "16"

                    device.api = "alsa"

                    device.class = "sound"

                    alsa.class = "generic"

                    alsa.subclass = "generic-mix"

                    alsa.name = "Loopback PCM"

                    alsa.id = "Loopback PCM"

                    alsa.subdevice = "0"

                    alsa.subdevice_name = "subdevice #0"

                    alsa.device = "0"

                    alsa.card = "0"

                    alsa.card_name = "Loopback"

                    alsa.long_card_name = "Loopback 1"

                    device.bus_path = "/devices/virtual/sound/card0"

                    sysfs.path = "/devices/virtual/sound/card0"

                    device.string = "front:0"

                    device.buffering.buffer_size = "352800"

                    device.buffering.fragment_size = "352800"

                    device.access_mode = "mmap+timer"

                    device.profile.name = "analog-stereo"

                    device.profile.description = "Analog Stereo"

                    device.description = "Loopback Analog Stereo"

                    alsa.mixer_name = "Loopback Mixer"

                    module-udev-detect.discovered = "1"

                    device.icon_name = "audio-card"

                Ports:

                    analog-input: Analog Input (priority: 10000)

                Active Port: analog-input

                Formats:

                    pcm

             

            Client #1

                Driver: protocol-native.c

                Owner Module: 3

                Properties:

                    application.name = "pactl"

                    native-protocol.peer = "UNIX socket client"

                    native-protocol.version = "30"

                    application.process.id = "368"

                    application.process.user = "root"

                    application.process.host = "edison"

                    application.process.binary = "pactl"

                    application.language = "C"

                    application.process.machine_id = "a4ea6f25aa86447baf7fc901f28014fa"

             

            Card #0

                Name: alsa_card.0

                Driver: module-alsa-card.c

                Owner Module: 2

                Properties:

                    alsa.card = "0"

                    alsa.card_name = "Loopback"

                    alsa.long_card_name = "Loopback 1"

                    device.bus_path = "/devices/virtual/sound/card0"

                    sysfs.path = "/devices/virtual/sound/card0"

                    device.string = "0"

                    device.description = "Loopback"

                    module-udev-detect.discovered = "1"

                    device.icon_name = "audio-card"

                Profiles:

                    input:analog-mono: Analog Mono Input (sinks: 0, sources: 1, priority: 2, available: yes)

                    input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority: 60, available: yes)

                    output:analog-mono: Analog Mono Output (sinks: 1, sources: 0, priority: 200, available: yes)

                    output:analog-mono+input:analog-mono: Analog Mono Duplex (sinks: 1, sources: 1, priority: 202, available: yes)

                    output:analog-mono+input:analog-stereo: Analog Mono Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 260, available: yes)

                    output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority: 6000, available: yes)

                    output:analog-stereo+input:analog-mono: Analog Stereo Output + Analog Mono Input (sinks: 1, sources: 1, priority: 6002, available: yes)

                    output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (sinks: 1, sources: 1, priority: 6060, available: yes)

                    output:analog-surround-21: Analog Surround 2.1 Output (sinks: 1, sources: 0, priority: 800, available: yes)

                    output:analog-surround-21+input:analog-mono: Analog Surround 2.1 Output + Analog Mono Input (sinks: 1, sources: 1, priority: 802, available: yes)

                    output:analog-surround-21+input:analog-stereo: Analog Surround 2.1 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 860, available: yes)

                    output:analog-surround-40: Analog Surround 4.0 Output (sinks: 1, sources: 0, priority: 700, available: yes)

                    output:analog-surround-40+input:analog-mono: Analog Surround 4.0 Output + Analog Mono Input (sinks: 1, sources: 1, priority: 702, available: yes)

                    output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 760, available: yes)

                    output:analog-surround-41: Analog Surround 4.1 Output (sinks: 1, sources: 0, priority: 800, available: yes)

                    output:analog-surround-41+input:analog-mono: Analog Surround 4.1 Output + Analog Mono Input (sinks: 1, sources: 1, priority: 802, available: yes)

                    output:analog-surround-41+input:analog-stereo: Analog Surround 4.1 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 860, available: yes)

                    output:analog-surround-50: Analog Surround 5.0 Output (sinks: 1, sources: 0, priority: 700, available: yes)

                    output:analog-surround-50+input:analog-mono: Analog Surround 5.0 Output + Analog Mono Input (sinks: 1, sources: 1, priority: 702, available: yes)

                    output:analog-surround-50+input:analog-stereo: Analog Surround 5.0 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 760, available: yes)

                    output:analog-surround-51: Analog Surround 5.1 Output (sinks: 1, sources: 0, priority: 800, available: yes)

                    output:analog-surround-51+input:analog-mono: Analog Surround 5.1 Output + Analog Mono Input (sinks: 1, sources: 1, priority: 802, available: yes)

                    output:analog-surround-51+input:analog-stereo: Analog Surround 5.1 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 860, available: yes)

                    output:analog-surround-71: Analog Surround 7.1 Output (sinks: 1, sources: 0, priority: 700, available: yes)

                    output:analog-surround-71+input:analog-mono: Analog Surround 7.1 Output + Analog Mono Input (sinks: 1, sources: 1, priority: 702, available: yes)

                    output:analog-surround-71+input:analog-stereo: Analog Surround 7.1 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 760, available: yes)

                    off: Off (sinks: 0, sources: 0, priority: 0, available: yes)

                Active Profile: output:analog-stereo+input:analog-stereo

                Ports:

                    analog-input: Analog Input (priority: 10000, latency offset: 0 usec)

                        Part of profile(s): input:analog-mono, input:analog-stereo, output:analog-mono+input:analog-mono, output:analog-mono+input:analog-stereo, output:analog-stereo+input:analog-mono, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-mono, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-mono, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analog-mono, output:analog-surround-41+input:analog-stereo, output:analog-surround-50+input:analog-mono, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-mono, output:analog-surround-51+input:analog-stereo, output:analog-surround-71+input:analog-mono, output:analog-surround-71+input:analog-stereo

                    analog-output: Analog Output (priority: 9900, latency offset: 0 usec)

                        Part of profile(s): output:analog-mono, output:analog-mono+input:analog-mono, output:analog-mono+input:analog-stereo, output:analog-stereo, output:analog-stereo+input:analog-mono, output:analog-stereo+input:analog-stereo, output:analog-surround-21, output:analog-surround-21+input:analog-mono, output:analog-surround-21+input:analog-stereo, output:analog-surround-40, output:analog-surround-40+input:analog-mono, output:analog-surround-40+input:analog-stereo, output:analog-surround-41, output:analog-surround-41+input:analog-mono, output:analog-surround-41+input:analog-stereo, output:analog-surround-50, output:analog-surround-50+input:analog-mono, output:analog-surround-50+input:analog-stereo, output:analog-surround-51, output:analog-surround-51+input:analog-mono, output:analog-surround-51+input:analog-stereo, output:analog-surround-71, output:analog-surround-71+input:analog-mono, output:analog-surround-71+input:analog-stereo

            • 3. Re: GPIO pinmode 1 in mraa code?
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi bennnn,
               
              I get the same results as you. Please let me investigate about this and if I'm able to find something useful I will post it here.
               
              -Peter.

              • 4. Re: GPIO pinmode 1 in mraa code?
                bennnn

                Great thanks for looking into this.

                 

                I have an arduino adapter board and have the mini intel breakout board in the post so can try both.

                 

                I found that the arduino baord uses pins

                 

                arduino     SSP2

                 

                PIN 10      SSP2_FS

                PIN 11      SSP2_TXD

                PIN 12      SSP2_RXD

                PIN 13      SSP2_CLK

                 

                I will hook up my oscilloscope to the SS2 and play some audio and post results here when I get time.

                 

                I'm assuming SSP2_CLK is MCLK and SSP2_FS is BCLCK.

                 

                My DSP clock is 24.576mhz but the IO port I want to use can sync to the edison (master) in slave mode as long as its normal I2S / TDM clock derived from a multiple of sample frequency.

                 

                Look forward to getting any info regarding SSP2 will take a look at the Quark SoC x1000 data sheet also to see if there is any info.

                 

                 

                ben

                • 5. Re: GPIO pinmode 1 in mraa code?
                  bennnn

                  OK, I think I have to get the source tree located here Download Intel® Edison Board Software Package

                   

                  downloading now...

                   

                  then I need to modify the dummy codec driver in the source located here

                   

                  /linux/sound/soc/intel/board/merr_dpcm_dummy.c

                   

                  I don't actually need machine control since I'm not looking to add a codec.

                   

                  I only need to make changes to the SSP2 port configuration to TDM 4 slot or TDM 8 slot.

                   

                  I will report back here if merr_dpcm_dummy.c makes sence to me

                   

                  I have built modified kernels beore but never yokto ...

                   

                  EDIT > ok I think I should start a new thread , this one started as a pinmode question and ended as a kernel building question !!

                  1 of 1 people found this helpful