Hardware testing for M24SR-DISCOVERY demo PCB. as help to others
Set up to use MB1138 M24SR-DISCOVERY PCB http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/st25-nfc-rfid-eval-boards/st25-nfc-rfid-eval-boards/m24sr-discovery.html with MBED system. based on https://developer.mbed.org/users/hudakz/code/STM32F103C8T6_Hello/ code and https://developer.mbed.org/users/wim/notebook/m24sr64-nfcrfid-tag-with-i2c-interface/ Which lead me to look at Peter Drescher's work on ILI9341 LCD controller
https://developer.mbed.org/users/dreschpe/code/SPI_TFT_ILI9341/
M24SR-DISCOVERY_hardware/mbed-STM32F103RGT6/PinNames.h@0:ce5a25daadce, 2016-09-22 (annotated)
- Committer:
- lloydg
- Date:
- Thu Sep 22 10:43:55 2016 +0000
- Revision:
- 0:ce5a25daadce
my start
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lloydg | 0:ce5a25daadce | 1 | /* mbed Microcontroller Library |
lloydg | 0:ce5a25daadce | 2 | ******************************************************************************* |
lloydg | 0:ce5a25daadce | 3 | * Copyright (c) 2014, STMicroelectronics |
lloydg | 0:ce5a25daadce | 4 | * All rights reserved. |
lloydg | 0:ce5a25daadce | 5 | * |
lloydg | 0:ce5a25daadce | 6 | * Redistribution and use in source and binary forms, with or without |
lloydg | 0:ce5a25daadce | 7 | * modification, are permitted provided that the following conditions are met: |
lloydg | 0:ce5a25daadce | 8 | * |
lloydg | 0:ce5a25daadce | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
lloydg | 0:ce5a25daadce | 10 | * this list of conditions and the following disclaimer. |
lloydg | 0:ce5a25daadce | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
lloydg | 0:ce5a25daadce | 12 | * this list of conditions and the following disclaimer in the documentation |
lloydg | 0:ce5a25daadce | 13 | * and/or other materials provided with the distribution. |
lloydg | 0:ce5a25daadce | 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
lloydg | 0:ce5a25daadce | 15 | * may be used to endorse or promote products derived from this software |
lloydg | 0:ce5a25daadce | 16 | * without specific prior written permission. |
lloydg | 0:ce5a25daadce | 17 | * |
lloydg | 0:ce5a25daadce | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
lloydg | 0:ce5a25daadce | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
lloydg | 0:ce5a25daadce | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
lloydg | 0:ce5a25daadce | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
lloydg | 0:ce5a25daadce | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
lloydg | 0:ce5a25daadce | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
lloydg | 0:ce5a25daadce | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
lloydg | 0:ce5a25daadce | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
lloydg | 0:ce5a25daadce | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
lloydg | 0:ce5a25daadce | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
lloydg | 0:ce5a25daadce | 28 | ******************************************************************************* |
lloydg | 0:ce5a25daadce | 29 | * |
lloydg | 0:ce5a25daadce | 30 | * Modified for STM32F103C6T8 by Zoltan Hudak, 2016 |
lloydg | 0:ce5a25daadce | 31 | * |
lloydg | 0:ce5a25daadce | 32 | */ |
lloydg | 0:ce5a25daadce | 33 | #ifndef MBED_PINNAMES_H |
lloydg | 0:ce5a25daadce | 34 | #define MBED_PINNAMES_H |
lloydg | 0:ce5a25daadce | 35 | |
lloydg | 0:ce5a25daadce | 36 | #include "cmsis.h" |
lloydg | 0:ce5a25daadce | 37 | |
lloydg | 0:ce5a25daadce | 38 | #ifdef __cplusplus |
lloydg | 0:ce5a25daadce | 39 | extern "C" { |
lloydg | 0:ce5a25daadce | 40 | #endif |
lloydg | 0:ce5a25daadce | 41 | |
lloydg | 0:ce5a25daadce | 42 | // See stm32f3xx_hal_gpio.h and stm32f3xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM |
lloydg | 0:ce5a25daadce | 43 | #define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM) << 7) | ((PUPD) << 4) | ((MODE) << 0))) |
lloydg | 0:ce5a25daadce | 44 | #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) |
lloydg | 0:ce5a25daadce | 45 | #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) |
lloydg | 0:ce5a25daadce | 46 | #define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) |
lloydg | 0:ce5a25daadce | 47 | #define STM_MODE_INPUT (0) |
lloydg | 0:ce5a25daadce | 48 | #define STM_MODE_OUTPUT_PP (1) |
lloydg | 0:ce5a25daadce | 49 | #define STM_MODE_OUTPUT_OD (2) |
lloydg | 0:ce5a25daadce | 50 | #define STM_MODE_AF_PP (3) |
lloydg | 0:ce5a25daadce | 51 | #define STM_MODE_AF_OD (4) |
lloydg | 0:ce5a25daadce | 52 | #define STM_MODE_ANALOG (5) |
lloydg | 0:ce5a25daadce | 53 | #define STM_MODE_IT_RISING (6) |
lloydg | 0:ce5a25daadce | 54 | #define STM_MODE_IT_FALLING (7) |
lloydg | 0:ce5a25daadce | 55 | #define STM_MODE_IT_RISING_FALLING (8) |
lloydg | 0:ce5a25daadce | 56 | #define STM_MODE_EVT_RISING (9) |
lloydg | 0:ce5a25daadce | 57 | #define STM_MODE_EVT_FALLING (10) |
lloydg | 0:ce5a25daadce | 58 | #define STM_MODE_EVT_RISING_FALLING (11) |
lloydg | 0:ce5a25daadce | 59 | #define STM_MODE_IT_EVT_RESET (12) |
lloydg | 0:ce5a25daadce | 60 | |
lloydg | 0:ce5a25daadce | 61 | // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) |
lloydg | 0:ce5a25daadce | 62 | // Low nibble = pin number |
lloydg | 0:ce5a25daadce | 63 | #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) |
lloydg | 0:ce5a25daadce | 64 | #define STM_PIN(X) ((uint32_t)(X) & 0xF) |
lloydg | 0:ce5a25daadce | 65 | |
lloydg | 0:ce5a25daadce | 66 | typedef enum { |
lloydg | 0:ce5a25daadce | 67 | PIN_INPUT, |
lloydg | 0:ce5a25daadce | 68 | PIN_OUTPUT |
lloydg | 0:ce5a25daadce | 69 | } |
lloydg | 0:ce5a25daadce | 70 | PinDirection; |
lloydg | 0:ce5a25daadce | 71 | |
lloydg | 0:ce5a25daadce | 72 | typedef enum { |
lloydg | 0:ce5a25daadce | 73 | PA_0 = 0x00, |
lloydg | 0:ce5a25daadce | 74 | PA_1 = 0x01, |
lloydg | 0:ce5a25daadce | 75 | PA_2 = 0x02, |
lloydg | 0:ce5a25daadce | 76 | PA_3 = 0x03, |
lloydg | 0:ce5a25daadce | 77 | PA_4 = 0x04, |
lloydg | 0:ce5a25daadce | 78 | PA_5 = 0x05, |
lloydg | 0:ce5a25daadce | 79 | PA_6 = 0x06, |
lloydg | 0:ce5a25daadce | 80 | PA_7 = 0x07, |
lloydg | 0:ce5a25daadce | 81 | PA_8 = 0x08, |
lloydg | 0:ce5a25daadce | 82 | PA_9 = 0x09, |
lloydg | 0:ce5a25daadce | 83 | PA_10 = 0x0A, |
lloydg | 0:ce5a25daadce | 84 | PA_11 = 0x0B, |
lloydg | 0:ce5a25daadce | 85 | PA_12 = 0x0C, |
lloydg | 0:ce5a25daadce | 86 | PA_15 = 0x0F, |
lloydg | 0:ce5a25daadce | 87 | |
lloydg | 0:ce5a25daadce | 88 | PB_0 = 0x10, |
lloydg | 0:ce5a25daadce | 89 | PB_1 = 0x11, |
lloydg | 0:ce5a25daadce | 90 | PB_3 = 0x13, |
lloydg | 0:ce5a25daadce | 91 | PB_4 = 0x14, |
lloydg | 0:ce5a25daadce | 92 | PB_5 = 0x15, |
lloydg | 0:ce5a25daadce | 93 | PB_6 = 0x16, |
lloydg | 0:ce5a25daadce | 94 | PB_7 = 0x17, |
lloydg | 0:ce5a25daadce | 95 | PB_8 = 0x18, |
lloydg | 0:ce5a25daadce | 96 | PB_9 = 0x19, |
lloydg | 0:ce5a25daadce | 97 | PB_10 = 0x1A, |
lloydg | 0:ce5a25daadce | 98 | PB_11 = 0x1B, |
lloydg | 0:ce5a25daadce | 99 | PB_12 = 0x1C, |
lloydg | 0:ce5a25daadce | 100 | PB_13 = 0x1D, |
lloydg | 0:ce5a25daadce | 101 | PB_14 = 0x1E, |
lloydg | 0:ce5a25daadce | 102 | PB_15 = 0x1F, |
lloydg | 0:ce5a25daadce | 103 | |
lloydg | 0:ce5a25daadce | 104 | PC_0 = 0x20, |
lloydg | 0:ce5a25daadce | 105 | PC_1 = 0x21, |
lloydg | 0:ce5a25daadce | 106 | PC_2 = 0x22, |
lloydg | 0:ce5a25daadce | 107 | PC_3 = 0x23, |
lloydg | 0:ce5a25daadce | 108 | PC_4 = 0x24, |
lloydg | 0:ce5a25daadce | 109 | PC_5 = 0x25, |
lloydg | 0:ce5a25daadce | 110 | PC_6 = 0x26, |
lloydg | 0:ce5a25daadce | 111 | PC_7 = 0x27, |
lloydg | 0:ce5a25daadce | 112 | PC_8 = 0x28, |
lloydg | 0:ce5a25daadce | 113 | PC_9 = 0x29, |
lloydg | 0:ce5a25daadce | 114 | PC_10 = 0x2A, |
lloydg | 0:ce5a25daadce | 115 | PC_11 = 0x2B, |
lloydg | 0:ce5a25daadce | 116 | PC_12 = 0x2C, |
lloydg | 0:ce5a25daadce | 117 | PC_13 = 0x2D, |
lloydg | 0:ce5a25daadce | 118 | PC_14 = 0x2E, |
lloydg | 0:ce5a25daadce | 119 | PC_15 = 0x2F, |
lloydg | 0:ce5a25daadce | 120 | |
lloydg | 0:ce5a25daadce | 121 | |
lloydg | 0:ce5a25daadce | 122 | |
lloydg | 0:ce5a25daadce | 123 | // Arduino connector namings |
lloydg | 0:ce5a25daadce | 124 | A0 = PA_0, |
lloydg | 0:ce5a25daadce | 125 | A1 = PA_1, |
lloydg | 0:ce5a25daadce | 126 | A2 = PA_4, |
lloydg | 0:ce5a25daadce | 127 | A3 = PB_0, |
lloydg | 0:ce5a25daadce | 128 | D0 = PA_3, |
lloydg | 0:ce5a25daadce | 129 | D1 = PA_2, |
lloydg | 0:ce5a25daadce | 130 | D2 = PA_10, |
lloydg | 0:ce5a25daadce | 131 | D3 = PB_3, |
lloydg | 0:ce5a25daadce | 132 | D4 = PB_5, |
lloydg | 0:ce5a25daadce | 133 | D5 = PB_4, |
lloydg | 0:ce5a25daadce | 134 | D6 = PB_10, |
lloydg | 0:ce5a25daadce | 135 | D7 = PA_8, |
lloydg | 0:ce5a25daadce | 136 | D8 = PA_9, |
lloydg | 0:ce5a25daadce | 137 | D10 = PB_6, |
lloydg | 0:ce5a25daadce | 138 | D11 = PA_7, |
lloydg | 0:ce5a25daadce | 139 | D12 = PA_6, |
lloydg | 0:ce5a25daadce | 140 | D13 = PA_5, |
lloydg | 0:ce5a25daadce | 141 | D14 = PB_9, |
lloydg | 0:ce5a25daadce | 142 | D15 = PB_8, |
lloydg | 0:ce5a25daadce | 143 | //m24sr discovery names |
lloydg | 0:ce5a25daadce | 144 | BT_RESET = PA_3, |
lloydg | 0:ce5a25daadce | 145 | M24SR_GPO = PA_6, |
lloydg | 0:ce5a25daadce | 146 | M24SR_RF_disable = PA_7, |
lloydg | 0:ce5a25daadce | 147 | BT_POWER_ON = PA_10, |
lloydg | 0:ce5a25daadce | 148 | USB_DM = PA_11, |
lloydg | 0:ce5a25daadce | 149 | USB_DP = PA_12, |
lloydg | 0:ce5a25daadce | 150 | //JTMS = PA_13, |
lloydg | 0:ce5a25daadce | 151 | //JTCK = PA_14, |
lloydg | 0:ce5a25daadce | 152 | JTDI = PA_15, |
lloydg | 0:ce5a25daadce | 153 | USB_Disconnect = PB_0, |
lloydg | 0:ce5a25daadce | 154 | JTDO = PB_3, |
lloydg | 0:ce5a25daadce | 155 | JTRST = PB_4, |
lloydg | 0:ce5a25daadce | 156 | JOY_LEFT = PB_5, |
lloydg | 0:ce5a25daadce | 157 | JOY_SEL = PB_5, |
lloydg | 0:ce5a25daadce | 158 | JOY_DOWN = PB_7, |
lloydg | 0:ce5a25daadce | 159 | JOY_RIGHT = PB_8, |
lloydg | 0:ce5a25daadce | 160 | JOY_UP = PB_9, |
lloydg | 0:ce5a25daadce | 161 | M24SR_SCL = PB_10, |
lloydg | 0:ce5a25daadce | 162 | M24SR_SDA = PB_11, |
lloydg | 0:ce5a25daadce | 163 | LCD_CS = PB_12, |
lloydg | 0:ce5a25daadce | 164 | LCD_CLK = PB_13, |
lloydg | 0:ce5a25daadce | 165 | LCD_SDA = PB_15, |
lloydg | 0:ce5a25daadce | 166 | LCD_DC = PC_6, |
lloydg | 0:ce5a25daadce | 167 | TE_Output = PC_7, |
lloydg | 0:ce5a25daadce | 168 | STM32_TX = PC_10, |
lloydg | 0:ce5a25daadce | 169 | STM32_RX = PC_11, |
lloydg | 0:ce5a25daadce | 170 | BT_GPIO1 = PC_12, |
lloydg | 0:ce5a25daadce | 171 | LED1 = PC_3, |
lloydg | 0:ce5a25daadce | 172 | LED2 = PC_2, |
lloydg | 0:ce5a25daadce | 173 | LED3 = PC_1, |
lloydg | 0:ce5a25daadce | 174 | LED4 = PC_0, |
lloydg | 0:ce5a25daadce | 175 | |
lloydg | 0:ce5a25daadce | 176 | // Generic signals namings |
lloydg | 0:ce5a25daadce | 177 | |
lloydg | 0:ce5a25daadce | 178 | SERIAL_TX = PC_10, |
lloydg | 0:ce5a25daadce | 179 | SERIAL_RX = PC_11, |
lloydg | 0:ce5a25daadce | 180 | USBTX = PA_2, |
lloydg | 0:ce5a25daadce | 181 | USBRX = PA_3, |
lloydg | 0:ce5a25daadce | 182 | I2C_SCL = PB_10, |
lloydg | 0:ce5a25daadce | 183 | I2C_SDA = PB_11, |
lloydg | 0:ce5a25daadce | 184 | SPI_MOSI = PA_7, |
lloydg | 0:ce5a25daadce | 185 | SPI_MISO = PA_6, |
lloydg | 0:ce5a25daadce | 186 | SPI_SCK = PA_5, |
lloydg | 0:ce5a25daadce | 187 | SPI_CS = PB_6, |
lloydg | 0:ce5a25daadce | 188 | PWM_OUT = PB_3, |
lloydg | 0:ce5a25daadce | 189 | |
lloydg | 0:ce5a25daadce | 190 | // Not connected |
lloydg | 0:ce5a25daadce | 191 | NC = (int)0xFFFFFFFF |
lloydg | 0:ce5a25daadce | 192 | } PinName; |
lloydg | 0:ce5a25daadce | 193 | |
lloydg | 0:ce5a25daadce | 194 | typedef enum { |
lloydg | 0:ce5a25daadce | 195 | PullNone = 0, |
lloydg | 0:ce5a25daadce | 196 | PullUp = 1, |
lloydg | 0:ce5a25daadce | 197 | PullDown = 2, |
lloydg | 0:ce5a25daadce | 198 | OpenDrain = 3, |
lloydg | 0:ce5a25daadce | 199 | PullDefault = PullNone |
lloydg | 0:ce5a25daadce | 200 | } PinMode; |
lloydg | 0:ce5a25daadce | 201 | |
lloydg | 0:ce5a25daadce | 202 | #ifdef __cplusplus |
lloydg | 0:ce5a25daadce | 203 | } |
lloydg | 0:ce5a25daadce | 204 | #endif |
lloydg | 0:ce5a25daadce | 205 | |
lloydg | 0:ce5a25daadce | 206 | #endif |