티스토리 뷰

프로그래밍/C#

MinnowBoard Max Pin Mappings

뽀로로친구에디 2018. 8. 23. 17:12

MinnowBoard Max Pin Mappings (민노우보드 맥스 핀 매핑)

Overview

MinnowBoard Max Pin Header

출처: https://docs.microsoft.com/en-us/windows/iot-core/learn-about-hardware/pinmappings/pinmappingsmbm

MinnowBoard Max의 하드웨어 인터페이스는 보드의 26 핀 헤더 JP1을 통해 노출됩니다. 기능에는 다음이 포함됩니다.

  • 10x - GPIO pins
  • 2x - Serial UARTs
  • 1x - SPI bus
  • 1x - I2C bus
  • 1x - 5V power pin
  • 1x - 3.3V power pin
  • 2x - Ground pins
MinnowBoard Max는 모든 IO 핀에서 3.3V 로직 레벨을 사용합니다. 또한 모든 핀은 전원 및 접지 핀을 제외하고는 TXS0104E 레벨 쉬프터에 의해 버퍼링됩니다. 이 레벨 쉬프터는 10KΩ의 저항 풀업이있는 오픈 컬렉터 출력으로 나타나며 IO가 입력 또는 출력으로 설정되었는지 여부에 관계없이 풀업이 발생합니다. 레벨 쉬프터의 오픈 컬렉터 특성은 핀이 '0'을 강하게 출력 할 수 있지만 '1'만 약하게 출력한다는 것입니다. 핀 (LED 등)에서 전류를 끌어 오는 장치를 부착 할 때 유의해야합니다. LED를 MinnowBoard Max에 연결하는 올바른 방법은 블링키 샘플을 참조하십시오.

GPIO 핀

다음 GPIO 핀은 API를 통해 액세스 할 수 있습니다.

GPIO#Header Pin
021
123
225
314
416
518
620
722
824
926


참고 : GPIO 4 및 GPIO 5는 BIOS의 부트 스트랩 구성 핀으로 MinnowBoard Max에서 사용됩니다. 부트 중에 연결된 장치로 인해 GPIO가 낮아지지 않도록하십시오. 그러면 MBM이 부팅되지 않을 수 있습니다. MBM이 BIOS를지나 부팅 된 후이 GPIO를 정상적으로 사용할 수 있습니다.


GPIO 샘플

예를 들어, 다음 코드는 GPIO 5를 출력으로 열고 디지털 '1'을 핀에 씁니다.

C#
using Windows.Devices.Gpio;

public void GPIO()
{
    GpioController Controller = GpioController.GetDefault(); /* Get the default GPIO controller on the system */

    GpioPin Pin = Controller.OpenPin(5);        /* Open GPIO 5                      */
    Pin.SetDriveMode(GpioPinDriveMode.Output);  /* Set the IO direction as output   */
    Pin.Write(GpioPinValue.High);               /* Output a digital '1'             */
}


직렬 UART

MBM에는 UART1과 UART2의 두 가지 Serial UARTS가있다.


UART1은 표준 UART1 TX 및 UART1 RX 라인과 흐름 제어 신호 UART1 CTS 및 UART1 RTS를 가지고있다.


핀 6 - UART1 TX

핀 8 - UART1 RX

핀 10 - UART1 CTS

핀 12 - UART1 RTS

UART1은 빌드 10240에서 작동하지 않습니다. UART2 또는 USB 직렬 변환기를 사용하십시오.


UART2는 UART2 TX 및 UART2 RX 라인 만 포함합니다.


핀 17 - UART2 TX

핀 19 - UART2 RX

UART2는 흐름 제어를 지원하지 않으므로 SerialDevice의 다음 속성에 액세스하면 예외가 발생할 수 있습니다.


BreakSignalState

IsDataTerminalReadyEnabled

IsRequestToSendEnabled

핸드 셰이크 - SerialHandshake.None 만 지원됩니다.

아래의 예는 UART2를 초기화하고 쓰기를 수행 한 후 읽기를 수행합니다 :

C#
using Windows.Storage.Streams;
using Windows.Devices.Enumeration;
using Windows.Devices.SerialCommunication;

public async void Serial()
{
    string aqs = SerialDevice.GetDeviceSelector("UART2");                   /* Find the selector string for the serial device   */
    var dis = await DeviceInformation.FindAllAsync(aqs);                    /* Find the serial device with our selector string  */
    SerialDevice SerialPort = await SerialDevice.FromIdAsync(dis[0].Id);    /* Create an serial device with our selected device */

    /* Configure serial settings */
    SerialPort.WriteTimeout = TimeSpan.FromMilliseconds(1000);
    SerialPort.ReadTimeout = TimeSpan.FromMilliseconds(1000);
    SerialPort.BaudRate = 9600;
    SerialPort.Parity = SerialParity.None;         
    SerialPort.StopBits = SerialStopBitCount.One;
    SerialPort.DataBits = 8;

    /* Write a string out over serial */
    string txBuffer = "Hello Serial";
    DataWriter dataWriter = new DataWriter();
    dataWriter.WriteString(txBuffer);
    uint bytesWritten = await SerialPort.OutputStream.WriteAsync(dataWriter.DetachBuffer());

    /* Read data in from the serial port */
    const uint maxReadLength = 1024;
    DataReader dataReader = new DataReader(SerialPort.InputStream);
    uint bytesToRead = await dataReader.LoadAsync(maxReadLength);
    string rxBuffer = dataReader.ReadString(bytesToRead);
}

직렬 UART 코드를 실행하려면 UWP 프로젝트의 Package.appxmanifest 파일에 다음 기능을 추가해야합니다.


Visual Studio 2017에는 직렬 통신 기능에 영향을주는 매니페스트 디자이너 (appxmanifest 파일의 시각적 편집기)에 알려진 버그가 있습니다. appxmanifest가 직렬 통신 기능을 추가하면 appxmanifest를 디자이너로 수정하면 appxmanifest가 손상됩니다 (Device xml 하위가 손실 됨). appxmanifest를 마우스 오른쪽 버튼으로 클릭하고 컨텍스트 메뉴에서 코드보기를 선택하여 appxmanifest를 손으로 편집하여이 문제를 해결할 수 있습니다.


  <Capabilities>
    <DeviceCapability Name="serialcommunication">
      <Device Id="any">
        <Function Type="name:serialPort" />
      </Device>
    </DeviceCapability>
  </Capabilities>


I2C 버스

이 장치에서 사용할 수있는 I2C 버스를 살펴 보겠습니다.


I2C 개요

I2C 컨트롤러 I2C5는 핀 헤더에 SDA와 SCL의 두 라인이 노출되어있다. 이 라인에는 이미 10KΩ 내부 풀업 저항이있다.


핀 15 - I2C5 SDA

핀 13 - I2C5 SCL

I2C 샘플

아래의 예는 I2C5를 초기화하고 주소 0x40의 I2C 장치에 데이터를 씁니다.

C#
using Windows.Devices.Enumeration;
using Windows.Devices.I2c;

public async void I2C()
{
    // 0x40 is the I2C device address
    var settings = new I2cConnectionSettings(0x40);

    // FastMode = 400KHz
    settings.BusSpeed = I2cBusSpeed.FastMode;

    // Create an I2cDevice with the specified I2C settings
    var controller = await I2cController.GetDefaultAsync();

    using (I2cDevice device = controller.GetDevice(settings))
    {
        byte[] writeBuf = { 0x01, 0x02, 0x03, 0x04 };
        device.Write(writeBuf);
    }

}

I2C 문제

MinnowBoard Max는 특정 I2C 장치와의 통신 문제를 일으키는 I2C 버스와 관련된 알려진 문제점을 가지고 있습니다. 일반적으로 I2C 디바이스는 버스 요청 중에 어드레스를 확인 응답합니다. 그러나 특정 조건에서이 확인 응답은 레벨 쉬프터를 통해 MBM으로 다시 전달되지 않으며, 결과적으로 CPU는 장치가 응답하지 않고 버스 트랜잭션을 취소한다고 생각합니다. 이 문제는 IO 핀의 TXS0104E 레벨 쉬프터와 관련이있는 것으로 보입니다.이 레벨 쉬프터는 라인의 전압 스파이크로 인해 조기에 트리거 될 수 있습니다. 현재 해결 방법은 스파이크를 억제하는 데 도움이되는 I2C SCK 라인과 직렬로 100 옴 저항을 삽입하는 것입니다. 모든 장치가 영향을받지는 않으므로이 해결 방법은 버스 응답을받는 데 문제가있는 경우에만 필요합니다. 이 해결 방법이 필요한 것으로 알려진 장치 중 하나는 HTU21D입니다.


SPI 버스

이 장치에서 사용할 수있는 SPI 버스를 살펴 보겠습니다.


SPI 개요

MBM에는 하나의 SPI 컨트롤러 SPI0이 있습니다.


핀 9 - SPI0 MOSI

핀 7 - SPI0 MISO

핀 11 - SPI0 SCLK

핀 5 - SPI0 CS0

SPI 샘플

버스 SPI0에서 SPI 쓰기를 수행하는 방법에 대한 예는 다음과 같습니다.

C#
using Windows.Devices.Enumeration;
using Windows.Devices.Spi;

public async void SPI()
{
    // Use chip select line CS0
    var settings = new SpiConnectionSettings(0);
    // Set clock to 10MHz
    settings.ClockFrequency = 10000000;

    // Create an SpiDevice with the specified Spi settings
    var controller = await SpiController.GetDefaultAsync();

    using (SpiDevice device = controller.GetDevice(settings))
    {
        byte[] writeBuf = { 0x01, 0x02, 0x03, 0x04 };
        device.Write(writeBuf);
    }
}


'프로그래밍 > C#' 카테고리의 다른 글

맥 터미널에서 MySQL 접속하기  (0) 2018.09.21
맥에 MySQL 설치하기  (0) 2018.09.20
드래곤 보드 핀 매핑(Dragonboard Pin Mappings)  (0) 2018.08.23
Raspberry Pi 2 & 3 Pin Mappings  (0) 2018.08.23
하드웨어 호환성 목록  (0) 2018.08.23
댓글
최근에 달린 댓글
글 보관함
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Total
Today
Yesterday
    뽀로로친구에디
    최근에 올라온 글