Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open 2 x SPI bus at same time #1543

Merged
merged 1 commit into from
Jan 29, 2020
Merged

Unable to open 2 x SPI bus at same time #1543

merged 1 commit into from
Jan 29, 2020

Conversation

AdrianSoundy
Copy link
Member

2nd bus needs to use different DMA channel
Also updated CmakeSettings.json so i could build using VS

Tested with simple program to open both spi buses and write to both

using System;
using System.Threading;
using Windows.Devices.Spi;
using nanoFramework.Hardware.Esp32;

namespace SpiTest1
{
    public class Program
    {
        public static void Main()
        {
            // SPI pins mosi, miso, clk,           CS
            //  1       23    25    19  (default)   22
            //  2       4      5     17             18
            Configuration.SetPinFunction(17, DeviceFunction.SPI2_CLOCK);
            Configuration.SetPinFunction(5, DeviceFunction.SPI2_MISO);
            Configuration.SetPinFunction(4, DeviceFunction.SPI2_MOSI);

            var spi1 = SpiDevice.FromId("SPI1", new SpiConnectionSettings(22){ ClockFrequency = 1 * 1000 * 1000, DataBitLength = 8 });
            var spi2 = SpiDevice.FromId("SPI2", new SpiConnectionSettings(18) { ClockFrequency = 1 * 1000 * 1000, DataBitLength = 8 });

            while (true)
            {
                spi1.Write(new byte[] { 0x0 });
                spi2.Write(new byte[] { 0x0 });
                Thread.Sleep(1000);
            }
        }
    }
}

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Signed-off-by: adriansoundy adriansoundy@gmail.com

2nd bus needs to use different DMA channel
Updated CmakeSettings.json
@nfbot
Copy link
Member

nfbot commented Jan 29, 2020

Hi @AdrianSoundy,

I'm nanoFramework bot.
Thank you for your contribution!

A human will be reviewing it shortly. 😉

@AdrianSoundy AdrianSoundy merged commit 15616ab into nanoframework:develop Jan 29, 2020
@AdrianSoundy AdrianSoundy deleted the dualspitest branch January 29, 2020 09:58
@josesimoes josesimoes added Series: ESP32 Everything related specifically with ESP32 series targets Type: bug labels Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Series: ESP32 Everything related specifically with ESP32 series targets Type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants