max32630fthr quad spi , unexpected spi behavior

Committer:
boonshen
Date:
Tue Mar 13 21:12:00 2018 +0000
Revision:
0:a35c40f49345
MAX32630FTHR QuadSPI test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
boonshen 0:a35c40f49345 1 /*******************************************************************************
boonshen 0:a35c40f49345 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
boonshen 0:a35c40f49345 3 *
boonshen 0:a35c40f49345 4 * Permission is hereby granted, free of charge, to any person obtaining a
boonshen 0:a35c40f49345 5 * copy of this software and associated documentation files (the "Software"),
boonshen 0:a35c40f49345 6 * to deal in the Software without restriction, including without limitation
boonshen 0:a35c40f49345 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
boonshen 0:a35c40f49345 8 * and/or sell copies of the Software, and to permit persons to whom the
boonshen 0:a35c40f49345 9 * Software is furnished to do so, subject to the following conditions:
boonshen 0:a35c40f49345 10 *
boonshen 0:a35c40f49345 11 * The above copyright notice and this permission notice shall be included
boonshen 0:a35c40f49345 12 * in all copies or substantial portions of the Software.
boonshen 0:a35c40f49345 13 *
boonshen 0:a35c40f49345 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
boonshen 0:a35c40f49345 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
boonshen 0:a35c40f49345 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
boonshen 0:a35c40f49345 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
boonshen 0:a35c40f49345 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
boonshen 0:a35c40f49345 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
boonshen 0:a35c40f49345 20 * OTHER DEALINGS IN THE SOFTWARE.
boonshen 0:a35c40f49345 21 *
boonshen 0:a35c40f49345 22 * Except as contained in this notice, the name of Maxim Integrated
boonshen 0:a35c40f49345 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
boonshen 0:a35c40f49345 24 * Products, Inc. Branding Policy.
boonshen 0:a35c40f49345 25 *
boonshen 0:a35c40f49345 26 * The mere transfer of this software does not imply any licenses
boonshen 0:a35c40f49345 27 * of trade secrets, proprietary technology, copyrights, patents,
boonshen 0:a35c40f49345 28 * trademarks, maskwork rights, or any other form of intellectual
boonshen 0:a35c40f49345 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
boonshen 0:a35c40f49345 30 * ownership rights.
boonshen 0:a35c40f49345 31 *******************************************************************************
boonshen 0:a35c40f49345 32 */
boonshen 0:a35c40f49345 33
boonshen 0:a35c40f49345 34 #ifndef _MAX32630FTHR_H_
boonshen 0:a35c40f49345 35 #define _MAX32630FTHR_H_
boonshen 0:a35c40f49345 36
boonshen 0:a35c40f49345 37 #include "mbed.h"
boonshen 0:a35c40f49345 38 #include "MAX14690.h"
boonshen 0:a35c40f49345 39
boonshen 0:a35c40f49345 40 /**
boonshen 0:a35c40f49345 41 * @brief MAX32630FTHR Board Support Library
boonshen 0:a35c40f49345 42 *
boonshen 0:a35c40f49345 43 * @details The MAX32630FTHR is a rapid development application board for
boonshen 0:a35c40f49345 44 * ultra low power wearable applications. It includes common peripherals and
boonshen 0:a35c40f49345 45 * expansion connectors all power optimized for getting the longest life from
boonshen 0:a35c40f49345 46 * the battery. This library configures the power and I/O for the board.
boonshen 0:a35c40f49345 47 * <br>https://www.maximintegrated.com/max32630fthr
boonshen 0:a35c40f49345 48 *
boonshen 0:a35c40f49345 49 * @code
boonshen 0:a35c40f49345 50 * #include "mbed.h"
boonshen 0:a35c40f49345 51 * #include "max32630fthr.h"
boonshen 0:a35c40f49345 52 *
boonshen 0:a35c40f49345 53 * DigitalOut led1(LED1);
boonshen 0:a35c40f49345 54 * MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
boonshen 0:a35c40f49345 55 *
boonshen 0:a35c40f49345 56 * // main() runs in its own thread in the OS
boonshen 0:a35c40f49345 57 * // (note the calls to Thread::wait below for delays)
boonshen 0:a35c40f49345 58 * int main()
boonshen 0:a35c40f49345 59 * {
boonshen 0:a35c40f49345 60 * // initialize power and I/O on MAX32630FTHR board
boonshen 0:a35c40f49345 61 * pegasus.init();
boonshen 0:a35c40f49345 62 *
boonshen 0:a35c40f49345 63 * while (true) {
boonshen 0:a35c40f49345 64 * led1 = !led1;
boonshen 0:a35c40f49345 65 * Thread::wait(500);
boonshen 0:a35c40f49345 66 * }
boonshen 0:a35c40f49345 67 * }
boonshen 0:a35c40f49345 68 * @endcode
boonshen 0:a35c40f49345 69 */
boonshen 0:a35c40f49345 70 class MAX32630FTHR
boonshen 0:a35c40f49345 71 {
boonshen 0:a35c40f49345 72 public:
boonshen 0:a35c40f49345 73 // max32630fthr configuration utilities
boonshen 0:a35c40f49345 74
boonshen 0:a35c40f49345 75 /**
boonshen 0:a35c40f49345 76 * @brief IO Voltage
boonshen 0:a35c40f49345 77 * @details Enumerated options for operating voltage
boonshen 0:a35c40f49345 78 */
boonshen 0:a35c40f49345 79 typedef enum {
boonshen 0:a35c40f49345 80 VIO_1V8 = 0x00, ///< 1.8V IO voltage at headers (from BUCK2)
boonshen 0:a35c40f49345 81 VIO_3V3 = 0x01, ///< 3.3V IO voltage at headers (from LDO2)
boonshen 0:a35c40f49345 82 } vio_t;
boonshen 0:a35c40f49345 83
boonshen 0:a35c40f49345 84 /**
boonshen 0:a35c40f49345 85 * MAX32630FTHR constructor.
boonshen 0:a35c40f49345 86 *
boonshen 0:a35c40f49345 87 */
boonshen 0:a35c40f49345 88 MAX32630FTHR();
boonshen 0:a35c40f49345 89
boonshen 0:a35c40f49345 90 /**
boonshen 0:a35c40f49345 91 * MAX32630FTHR constructor.
boonshen 0:a35c40f49345 92 *
boonshen 0:a35c40f49345 93 */
boonshen 0:a35c40f49345 94 MAX32630FTHR(vio_t vio);
boonshen 0:a35c40f49345 95
boonshen 0:a35c40f49345 96 /**
boonshen 0:a35c40f49345 97 * MAX32630FTHR destructor.
boonshen 0:a35c40f49345 98 */
boonshen 0:a35c40f49345 99 ~MAX32630FTHR();
boonshen 0:a35c40f49345 100
boonshen 0:a35c40f49345 101 /**
boonshen 0:a35c40f49345 102 * @brief Initialize MAX32630FTHR board
boonshen 0:a35c40f49345 103 * @details Initializes PMIC and I/O on MAX32630FTHR board.
boonshen 0:a35c40f49345 104 * Configures PMIC to enable LDO2 and LDO3 at 3.3V.
boonshen 0:a35c40f49345 105 * Disables resisitive pulldown on MON(AIN_0)
boonshen 0:a35c40f49345 106 * Sets default I/O voltages to 3V3 for micro SD card.
boonshen 0:a35c40f49345 107 * Sets I/O voltage for header pins to hdrVio specified.
boonshen 0:a35c40f49345 108 * @param hdrVio I/O voltage for header pins
boonshen 0:a35c40f49345 109 * @returns 0 if no errors, -1 if error.
boonshen 0:a35c40f49345 110 */
boonshen 0:a35c40f49345 111 int init(vio_t hdrVio);
boonshen 0:a35c40f49345 112
boonshen 0:a35c40f49345 113 /**
boonshen 0:a35c40f49345 114 * @brief Sets I/O Voltage
boonshen 0:a35c40f49345 115 * @details Sets the voltage rail to be used for a given pin.
boonshen 0:a35c40f49345 116 * VIO_1V8 selects VDDIO which is supplied by Buck2, which is set at 1.8V,
boonshen 0:a35c40f49345 117 * VIO_3V3 selects VDDIOH which is supplied by LDO2, which is typically 3.3V/
boonshen 0:a35c40f49345 118 * @param pin Pin whose voltage supply is being assigned.
boonshen 0:a35c40f49345 119 * @param vio Voltage rail to be used for specified pin.
boonshen 0:a35c40f49345 120 * @returns 0 if no errors, -1 if error.
boonshen 0:a35c40f49345 121 */
boonshen 0:a35c40f49345 122 int vddioh(PinName pin, vio_t vio);
boonshen 0:a35c40f49345 123
boonshen 0:a35c40f49345 124 /// Local I2C bus for configuring PMIC and accessing BMI160 IMU.
boonshen 0:a35c40f49345 125 I2C i2c;
boonshen 0:a35c40f49345 126
boonshen 0:a35c40f49345 127 /// MAX14690 PMIC Instance
boonshen 0:a35c40f49345 128 MAX14690 max14690;
boonshen 0:a35c40f49345 129
boonshen 0:a35c40f49345 130 };
boonshen 0:a35c40f49345 131
boonshen 0:a35c40f49345 132 #endif /* _MAX32630FTHR_H_ */