12 Commits

Autor SHA1 Mensagem Data
Joel Murphy 6567f9e986 Update README.md 2015-03-11 15:55:07 -04:00
Joel Murphy fc28936500 Update README.md 2015-03-11 15:54:00 -04:00
biomurph 6ebd8db20d added board variant files
now you can find the OpenBCI 32 board in the mpide menu selector! It’s
under chipKIT!
2015-03-11 15:50:57 -04:00
Joel Murphy 3423fde538 Update OpenBCI_32bit_SD.pde 2015-03-11 11:38:37 -04:00
biomurph 836bb0764a moving the variant file to master 2015-03-10 17:24:48 -04:00
biomurph b30393c965 added mpide board variant files
files allow the ability to list OpenBCI 32 in the board drop down list
2015-03-10 17:21:10 -04:00
biomurph 36c7f8824d bug fix 2014-12-17 17:50:30 -05:00
Joel Murphy 1e4c86b941 Update README.md 2014-12-17 17:36:36 -05:00
Joel Murphy 4a9c12bae9 Update README.md 2014-12-17 17:36:11 -05:00
Joel Murphy 703e4b9bed Update OpenBCI_32bit_SD.pde 2014-12-17 17:31:37 -05:00
biomurph 76790402e9 first commit of button trigger branch
implementing the PROG button on the OBCI 32bit board as an external
trigger source
2014-12-17 17:30:20 -05:00
biomurph fc4d54f736 test 2014-12-17 17:23:12 -05:00
6 arquivos alterados com 1152 adições e 31 exclusões
+42 -14
Ver Arquivo
@@ -1,7 +1,7 @@
/*
*
* >>>> THIS CODE USED TO STREAM OpenBCI V3_32 DATA TO DONGLE <<<<
* >>>> May include the 60Hz notch filter by Chip Audette <<<<
* >>>> Implements External Trigger from PROG Push Button <<<<
*
* This code is written to target a PIC32MX250F128B with UDB32-MX2-DIP bootloader
* To Program, user must manually reset the PIC32 on the OpenBCI 32bit Board
@@ -10,14 +10,23 @@
*
*
* Made by Joel Murphy, Luke Travis, Conor Russomanno Summer, 2014.
* We're using the DSPI library, but our MISO and MOSI pins are not default
* Adjust file Mpide_new.app/Contents/Resources/Java/hardware/pic32/variants/DP32/Board_Defs.h
* Change the SPI1 defines thusly:
* #define _DSPI0_MISO_IN PPS_IN_SDI1
* #define _DSPI0_MISO_PIN 5 // [Changed for OpenBCI was 10] RA1 SDI1 SDI1R = RPA1 = 0
* #define _DSPI0_MOSI_OUT PPS_OUT_SDO1
* #define _DSPI0_MOSI_PIN 10 // [Changed for OpenBCI was 18] RA4 SDO1 RPA4R = SDO1 = 3
* Until chipKIT or Diligent allows user selection of MOSI/MISO
* Before you upload the firmware, you need to place the OpenBCI board variant files inside the mpide program folder:
* This will allow you to find the OpenBCI 32 board in mpide dropdown selection tree!
* Place the OpenBCI folder into the mpide application:
*
* On A Mac, right click the application mpide, and select 'Show Package Contents'
* place the entire OpenBCI folder in the variants folder here:
* Mpide/Contents/Resources/Java/hardware/pic32/variants
*
* On a Windows, place the entire OpenBCI folder in the variants folder here:
* C:\Program Files\mpide-blah\hardware\pic32\variants
*
* Move the files OpenBCI_32 and SD from the OpenBCI_32_Library folder and put it in your documents/mpide/libraries folder.
* Put the OpenBCI_32_SD into your documents/mpide folder and restart mpide to be able to select the sketch.
*
* When you upload the firmware, select the 'OpenBCI 32' from the Tools -> Board -> chipKIT menu,
* select the serial port of the dongle, then press upload!
*
*
* Any SDcard code is based on RawWrite example in SDFat library
* ASCII commands are received on the serial port to configure and control
@@ -67,8 +76,7 @@ int outputType;
//------------------------------------------------------------------------------
// << LIS3DH Accelerometer Business >>
// LIS3DH_SS on pin 5 defined in OpenBCI library
volatile boolean auxAvailable = false;
volatile boolean addAccel = true;
volatile boolean addAccelToSD;
boolean useAccelOnly = false;
//------------------------------------------------------------------------------
// << PUT FILTER STUFF HERE >>
@@ -78,12 +86,20 @@ boolean useFilters = false;
int LED = 11; // blue LED alias
int PGCpin = 12; // PGC pin goes high when PIC is in bootloader mode
//------------------------------------------------------------------------------
// << EXTERNAL TRIGGER FROM PROG PUSHBUTTON >>
int pushButton = 17; // the button is on pin D17
int pushButtonValue; // used to hold the latest button reading
int lastPushButtonValue; // used to remember the last button state
boolean addAuxToSD; // option to add the aux data to the SD card
//------------------------------------------------------------------------------
void setup(void) {
Serial0.begin(115200); // using hardware uart number 0
pinMode(LED, OUTPUT); digitalWrite(LED,HIGH); // blue LED
pinMode(PGCpin,OUTPUT); digitalWrite(PGCpin,LOW);// used to tell RFduino if we are in bootloader mode
pinMode(pushButton, INPUT); // set the button pin direction
pushButtonValue = lastPushButtonValue = digitalRead(pushButton); // seed
startFromScratch();
}
@@ -97,13 +113,25 @@ void loop() {
while(!(OBCI.isDataAvailable())){} // wait for DRDY pin...
OBCI.updateChannelData(); // get the fresh ADS results
pushButtonValue = digitalRead(pushButton); // feel the PROG button
if (pushButtonValue != lastPushButtonValue){ // if it's changed,
if (pushButtonValue == HIGH){ // if it's gone from LOW to HIGH
OBCI.auxData[0] = 0xFFFF; // take note (this could be a counter, or...)
OBCI.useAux = true; // set the OBCI.auxData flag
addAuxToSD = true; // add Aux Data to the SD card if it's there
}
lastPushButtonValue = pushButtonValue; // keep track of the changes
}
if(OBCI.useAccel && OBCI.LIS3DH_DataAvailable()){
OBCI.LIS3DH_updateAxisData(); // fresh axis data goes into the X Y Z
addAccel = true;
addAccelToSD = true; // adds accel data to SD card if you like that kind of thing
}
if(SDfileOpen){
writeDataToSDcard(sampleCounter); //
}
OBCI.sendChannelData(sampleCounter);
sampleCounter++;
}
@@ -466,8 +494,8 @@ void printRegisters(){
void startFromScratch(){
delay(1000);
Serial0.print("OpenBCI V3 32bit Board\nSetting ADS1299 Channel Values\n");
OBCI.useAccel = true; // option to add accelerometer dat to stream
OBCI.useAux = false; // option to add user data to stream not implimented yet
OBCI.useAccel = true; // option to add accelerometer data to stream
OBCI.useAux = false; // flag to add user data to stream
OBCI.initialize();
OBCI.configureLeadOffDetection(LOFF_MAG_6NA, LOFF_FREQ_31p2HZ);
Serial0.print("ADS1299 Device ID: 0x"); Serial0.println(OBCI.ADS_getDeviceID(),HEX);
+13 -3
Ver Arquivo
@@ -150,16 +150,26 @@ void writeDataToSDcard(byte sampleNumber){
// convert 24 bit channelData into HEX
for (int currentChannel = 0; currentChannel < 8; currentChannel++){
convertToHex(OBCI.channelDataInt[currentChannel], 5, addComma);
if(currentChannel == 6 && !addAccel) addComma = false; // format CSV
if(currentChannel == 6 && !addAccelToSD ){
if(!addAuxToSD){
addComma = false; // format CSV
}
}
}
if(addAccel == true){ // if we have accelerometer data to log
if(addAuxToSD == true){ // add the aux bytes to the data stream
for (int i = 0; i < 3; i++){
convertToHex(OBCI.auxData[i], 3, addComma);
if(i == 1) addComma = false;
}
addAuxToSD = false;
}else if(addAccelToSD == true){ // if we have accelerometer data to log
// convert 16 bit accelerometer data into HEX
for (int currentChannel = 0; currentChannel < 3; currentChannel++){
convertToHex(OBCI.axisData[currentChannel], 3, addComma);
if(currentChannel == 1) addComma = false;
}
addAccel = false; // disallow aux data logging
addAccelToSD = false; // disallow aux data logging
}// end of accelerometer data log
// add aux data logging...
}
+21 -14
Ver Arquivo
@@ -1,7 +1,9 @@
OpenBCI_32bit
=============
Repository containing the firmware for the 32bit OpenBCI board.
This branch implements the PROG button as an external trigger source.
#YOU MUST ALSO USE THE OpenBCI_32 LIBRARY UPDATED IN THIS BRANCH
Note that to USE the OpenBCI system, you will generally use the OpenBCI USB Dongle. The dongle requries that you install the FTDI drivers for your particular operating system: http://www.ftdichip.com/FTDrivers.htm
@@ -9,24 +11,29 @@ Remove the files OpenBCI_32 and SD from the OpenBCI_32_Library folder and put it
Put the OpenBCI_32_SD into your documents/mpide folder and restart mpide to be able to select the sketch.
Before you upload the firmware, you need to make a change to an library file inside the mpide program folder:
Before you upload the firmware, you need to place the OpenBCI board variant files inside the mpide program folder:
* We're using the DSPI library, but our MISO and MOSI pins are not default
* Adjust file Mpide.app/Contents/Resources/Java/hardware/pic32/variants/DP32/Board_Defs.h
* Find the DSPI0 pin definition section and change the defines thusly:
* #define _DSPI0_MISO_IN PPS_IN_SDI1
* #define _DSPI0_MISO_PIN 5 // [Changed for OpenBCI. Was 10] RA1 SDI1 SDI1R = RPA1 = 0
* #define _DSPI0_MOSI_OUT PPS_OUT_SDO1
* #define _DSPI0_MOSI_PIN 10 // [Changed for OpenBCI. Was 18] RA4 SDO1 RPA4R = SDO1 = 3
* This will be necessary until chipKIT or Diligent allows user selection of MOSI/MISO
* Or until we get our own OpenBCI Board selection from the mpide (!)
This will allow you to find the OpenBCI 32 board in mpide dropdown selection tree!
Place the OpenBCI folder into the mpide application:
When you upload the firmware, select the chipKIT DP32 from the Tools -> Board -> chipKIT menu,
select the serial port of the dongle,
then press upload.
On A Mac, right click the application mpide, and select 'Show Package Contents'
place the entire OpenBCI folder in the variants folder here:
Mpide/Contents/Resources/Java/hardware/pic32/variants
On a Windows, place the entire OpenBCI folder in the variants folder here:
C:\Program Files\mpide-blah\hardware\pic32\variants
Remove the files OpenBCI_32 and SD from the OpenBCI_32_Library folder and put it in your documents\mpide\libraries folder.
Put the OpenBCI_32_SD into your documents/mpide folder and restart mpide to be able to select the sketch.
When you upload the firmware, select the 'OpenBCI 32' from the Tools -> Board -> chipKIT menu, select the serial port of the dongle, then press upload!
We are uploading the sketch over air! There is a chance that the mpide will timeout during the upload process!
If this happens, you will need to unplug the dongle, and re-insert it to stop the upload.
Then, power cycle the OpenBCI board, as it is best that the Board radio comes on line after the dongle radio.
Then try again to upload. This is a known issue, and we can confirm that all boards shipped will take the upload
process, it just might take a couple of times to stick.
+608
Ver Arquivo
@@ -0,0 +1,608 @@
/************************************************************************/
/* */
/* Board_Data.c -- DP32 Customization Data Declarations */
/* */
/************************************************************************/
/* Author: Gene Apperson */
/* Copyright 2011, Digilent. All rights reserved */
/************************************************************************/
/* File Description: */
/* */
/* This file contains the board specific declartions and data structure */
/* to customize the chipKIT MPIDE for use with a CmodCK1 board using a */
/* PIC32 part in a 44-pin package. */
/* */
/* This code is based on earlier work: */
/* Copyright (c) 2010, 2011 by Mark Sproul */
/* Copyright (c) 2005, 2006 by David A. Mellis */
/* */
/************************************************************************/
/* Revision History: */
/* */
/* 11/28/2011(GeneA): Created by splitting data out of Board_Defs.h */
/* 03/26/2013(KeithV): Modified for DP32 board */
/* */
/************************************************************************/
//* This library is free software; you can redistribute it and/or
//* modify it under the terms of the GNU Lesser General Public
//* License as published by the Free Software Foundation; either
//* version 2.1 of the License, or (at your option) any later version.
//*
//* This library is distributed in the hope that it will be useful,
//* but WITHOUT ANY WARRANTY; without even the implied warranty of
//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
//* Lesser General Public License for more details.
//*
//* You should have received a copy of the GNU Lesser General
//* Public License along with this library; if not, write to the
//* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
//* Boston, MA 02111-1307 USA
/************************************************************************/
#if !defined(BOARD_DATA_C)
#define BOARD_DATA_C
#include <inttypes.h>
/* ------------------------------------------------------------ */
/* Data Tables */
/* ------------------------------------------------------------ */
/* The following declarations define data used in pin mapping. */
/* ------------------------------------------------------------ */
#if defined(OPT_BOARD_DATA)
/* ------------------------------------------------------------ */
/* This table is used to map from port number to the address of
** the TRIS register for the port. This is used for setting the
** pin direction.
*/
const uint32_t port_to_tris_PGM[] = {
NOT_A_PORT, //index value 0 is not used
#if defined(_PORTA)
(uint32_t)&TRISA,
#else
NOT_A_PORT,
#endif
#if defined(_PORTB)
(uint32_t)&TRISB,
#else
NOT_A_PORT,
#endif
#if defined(_PORTC)
(uint32_t)&TRISC,
#else
NOT_A_PORT,
#endif
#if defined(_PORTD)
(uint32_t)&TRISD,
#else
NOT_A_PORT,
#endif
#if defined(_PORTE)
(uint32_t)&TRISE,
#else
NOT_A_PORT,
#endif
#if defined(_PORTF)
(uint32_t)&TRISF,
#else
NOT_A_PORT,
#endif
#if defined(_PORTG)
(uint32_t)&TRISG,
#else
NOT_A_PORT,
#endif
NOT_A_PORT,
};
/* ------------------------------------------------------------ */
/* This table is used to map the digital pin number to the port
** containing that pin. The default mapping is to assign pin numbers
** for every possible port bit in order from PORTA to PORTG.
*/
const uint8_t digital_pin_to_port_PGM[] = {
// Pins 0 through 18
_IOPORT_PB, // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
_IOPORT_PB, // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
_IOPORT_PB, // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
_IOPORT_PB, // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
_IOPORT_PB, // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
_IOPORT_PB, // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
_IOPORT_PB, // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
_IOPORT_PB, // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
_IOPORT_PB, // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
_IOPORT_PA, // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
_IOPORT_PA, // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
_IOPORT_PB, // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
_IOPORT_PB, // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
_IOPORT_PB, // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
_IOPORT_PB, // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
_IOPORT_PA, // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
_IOPORT_PA, // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
_IOPORT_PB, // 17 J3-9 RB4 SOSCI/RPB4/RB4
_IOPORT_PA, // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
};
/* ------------------------------------------------------------ */
/* This table is used to map from digital pin number to a bit mask
** for the corresponding bit within the port.
*/
const uint16_t digital_pin_to_bit_mask_PGM[] = {
// Pins 0 through 18
_BV( 5 ) , // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
_BV( 7 ) , // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
_BV( 8 ) , // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
_BV( 9 ) , // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
_BV( 10 ) , // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
_BV( 11 ) , // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
_BV( 13 ), // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
_BV( 14 ), // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
_BV( 15 ) , // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
_BV( 0 ) , // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
_BV( 1 ) , // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
_BV( 0 ) , // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
_BV( 1 ), // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
_BV( 2 ), // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
_BV( 3 ) , // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
_BV( 2 ) , // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
_BV( 3 ) , // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
_BV( 4 ) , // 17 J3-9 RB4 SOSCI/RPB4/RB4
_BV( 4 ) , // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
};
/* ------------------------------------------------------------ */
/* This table is used to map from digital pin number to the output
** compare number, input capture number, and timer external clock
** input associated with that pin.
*/
const uint8_t digital_pin_to_timer_PGM[] = {
// Pins 0 through 18
NOT_ON_TIMER, // 0 J4-1 RB5 USB TMS/RPB5/USBID/RB5
NOT_ON_TIMER, // 1 J4-2 RB7 INT0 TDI/RPB7/CTED3/PMD5/INT0/RB7
_TIMER_OC2 | _TIMER_IC3, // 2 J4-3 RB8 OC2, INT3, IC3, SDO2 TCK/RPB8/SCL1/CTED10/PMD4/RB8
_TIMER_OC3 | _TIMER_TCK5, // 3 J4-4 RB9 OC3, INT1, TCK5 TDO/RPB9/SDA1/CTED4/PMD3/RB9
NOT_ON_TIMER, // 4 J4-5 RB10 D+ PGED2/RPB10/D+/CTED11/RB10
NOT_ON_TIMER, // 5 J4-6 RB11 D- PGEC2/RPB11/D-/RB11
_TIMER_OC5 | _TIMER_TCK4 | _TIMER_IC1, // 6 J4-7 RB13 OC5, TCK4, IC1, RX1 AN11/RPB13/CTPLS/PMRD/RB13
NOT_ON_TIMER, // 7 J4-8 RB14 SCK1, TX2 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
_TIMER_OC1, // 8 J4-9 RB15 OC1, SCK2 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
NOT_ON_TIMER, // 9 J3-1 RA0 CS1 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
NOT_ON_TIMER, // 10 J3-2 RA1 SDI1, RX2 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
_TIMER_IC2, // 11 J3-3 RB0 PGD, IC2 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
_TIMER_TCK3, // 12 J3-4 RB1 PGC, TCK3 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
_TIMER_OC4 | _TIMER_IC5, // 13 J3-5 RB2 OC4, INT2, IC1, SDI2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
_TIMER_TCK2 | _TIMER_IC4, // 14 J3-6 RB3 TCK2, IC4, TX1 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
NOT_ON_TIMER, // 15 J3-7 RA2 OSC-PRI OSC1/CLKI/RPA2/RA2
NOT_ON_TIMER, // 16 J3-8 RA3 OSC-PRI OSC2/CLKO/RPA3/PMA0/RA3
NOT_ON_TIMER, // 17 J3-9 RB4 INT4, CS2 SOSCI/RPB4/RB4
_TIMER_TCK1, // 18 J3-10 RA4 SDO1, TCK1 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
};
/* ------------------------------------------------------------ */
/* This table maps from a digital pin number to the corresponding
** PPS register. This register is used to select the peripheral output
** connected to the pin. The register is set to 0 to disconnedt the
** pin from any peripheral so it can be used as GPIO.
** For PIC32MX1xx/2xx series devices, the PPS output select registers
** are arranged as a contiguous series of 32 bit registers. This table
** treats these registers as an array of DWORDs an stores the index
** to the register.
*/
const uint8_t digital_pin_to_pps_out_PGM[] = {
// Pins 0 through 18
_PPS_OUT(_PPS_RPB5R), // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
_PPS_OUT(_PPS_RPB7R), // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
_PPS_OUT(_PPS_RPB8R), // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
_PPS_OUT(_PPS_RPB9R), // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
_PPS_OUT(_PPS_RPB10R), // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
_PPS_OUT(_PPS_RPB11R), // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
_PPS_OUT(_PPS_RPB13R), // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
_PPS_OUT(_PPS_RPB14R), // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
_PPS_OUT(_PPS_RPB15R), // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
_PPS_OUT(_PPS_RPA0R), // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
_PPS_OUT(_PPS_RPA1R), // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
_PPS_OUT(_PPS_RPB0R), // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
_PPS_OUT(_PPS_RPB1R), // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
_PPS_OUT(_PPS_RPB2R), // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
_PPS_OUT(_PPS_RPB3R), // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
_PPS_OUT(_PPS_RPA2R), // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
_PPS_OUT(_PPS_RPA3R), // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
_PPS_OUT(_PPS_RPB4R), // 17 J3-9 RB4 SOSCI/RPB4/RB4
_PPS_OUT(_PPS_RPA4R), // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
};
/* ------------------------------------------------------------ */
/* This table maps from the digital pin number to the value to be
** loaded into a PPS input select register to select that pin.
** It also maps from digital pin number to input/output pin set to
** which the pin belongs. The set mask is in the high four bits,
** the select value is in the low four bits.
** Note: if the PIC32 device has more than four pin sets, or more than
** 16 pin mapping choices per input function, then this table will have
** to be redefined as a table of uint16_t values and the macros used to
** access the table redefined as well.
*/
const uint8_t digital_pin_to_pps_in_PGM[] = {
// Pins 0 through 18
_PPS_IN(_PPS_RPB5), // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
_PPS_IN(_PPS_RPB7), // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
_PPS_IN(_PPS_RPB8), // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
_PPS_IN(_PPS_RPB9), // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
_PPS_IN(_PPS_RPB10), // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
_PPS_IN(_PPS_RPB11), // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
_PPS_IN(_PPS_RPB13), // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
_PPS_IN(_PPS_RPB14), // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
_PPS_IN(_PPS_RPB15), // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
_PPS_IN(_PPS_RPA0), // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
_PPS_IN(_PPS_RPA1), // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
_PPS_IN(_PPS_RPB0), // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
_PPS_IN(_PPS_RPB1), // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
_PPS_IN(_PPS_RPB2), // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
_PPS_IN(_PPS_RPB3), // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
_PPS_IN(_PPS_RPA2), // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
_PPS_IN(_PPS_RPA3), // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
_PPS_IN(_PPS_RPB4), // 17 J3-9 RB4 SOSCI/RPB4/RB4
_PPS_IN(_PPS_RPA4), // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
};
/* ------------------------------------------------------------ */
/* This table maps from a digital pin number to the corresponding
** analog pin number.
*/
//#if defined(_NOT_USED_)
const uint8_t digital_pin_to_analog_PGM[] = {
// Pins 0 through 38
NOT_ANALOG_PIN, // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
NOT_ANALOG_PIN, // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
NOT_ANALOG_PIN, // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
NOT_ANALOG_PIN, // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
NOT_ANALOG_PIN, // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
NOT_ANALOG_PIN, // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
_BOARD_AN0, // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
_BOARD_AN1, // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
_BOARD_AN2, // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
_BOARD_AN3, // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
_BOARD_AN4, // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
_BOARD_AN5, // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
_BOARD_AN6, // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
_BOARD_AN7, // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
_BOARD_AN8, // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
NOT_ANALOG_PIN, // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
NOT_ANALOG_PIN, // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
NOT_ANALOG_PIN, // 17 J3-9 RB4 SOSCI/RPB4/RB4
NOT_ANALOG_PIN, // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
};
//#endif
/* ------------------------------------------------------------ */
/* This table is used to map from the analog pin number to the
** actual A/D converter channel used for that pin.
** In the default case, where there is a one-to-one mapping, this
** table isn't needed as the analogInPinToChannel() macro is defined
** to provide the mapping.
*/
//#if defined(_NOT_USED_)
const uint8_t analog_pin_to_channel_PGM[] = {
//* Arduino Pin PIC32 Analog channel
11, //* A0 11
10, //* A1 10
9, //* A2 9
0, //* A3 0
1, //* A4 1
2, //* A5 2
3, //* A6 3
4, //* A7 4
5, //* A8 5
};
//#endif
/* ------------------------------------------------------------ */
/* This table maps from an output compare number as stored in the
** digital_pin_to_timer_PGM table to the digital pin number of the
** pin that OC is connected to. This table is only required for
** devices that support peripheral pin select (PPS), i.e. PIC32MX1xx/2xx
** devices.
*/
const uint8_t output_compare_to_digital_pin_PGM[] = {
PIN_OC1, // A0, B3, B4, B15, B7 ; B15 RPB15R = 5
PIN_OC2, // A1, B5, B1, B11, B8 ; B8 RPB8R = 5
PIN_OC3, // A3, B14, B0, B10, B9 ; B9 RPB9R = 5
PIN_OC4, // A2, B6, A4, B13, B2 ; B2 RPB2R = 5
PIN_OC5, // A2, B6, A4, B13, B2 ; B13 RPB13R = 6
};
/* ------------------------------------------------------------ */
/* This table maps from an external interrupt number to the digital
** pin for that interrupt.
*/
const uint8_t external_int_to_digital_pin_PGM[] = {
NOT_PPS_PIN, // INT0 is not mappable; RB7
PIN_INT1, // A3, B14, B0, B10, B9; B9 INT1R = RPB9 = 4
PIN_INT2, // A2, B6, A4, B13, B2; B2 INT2R = RPB2 = 4
PIN_INT3, // A1, B5, B1, B11, B8; B8 INT3R = RPB8 = 4
PIN_INT4 // A0, B3, B4, B15, B7; B4 INT4R = RPB4 = 2
};
/* ------------------------------------------------------------ */
/* Include Files for Board Customization Functions */
/* ------------------------------------------------------------ */
#if (OPT_BOARD_INIT != 0)
#include <plib.h>
#endif
/* ------------------------------------------------------------ */
/* Board Customization Functions */
/* ------------------------------------------------------------ */
/* */
/* The following can be used to customize the behavior of some */
/* of the core API functions. These provide hooks that can be */
/* used to extend or replace the default behavior of the core */
/* functions. To use one of these functions, add the desired */
/* code to the function skeleton below and then set the value */
/* of the appropriate compile switch above to 1. This will */
/* cause the hook function to be compiled into the build and */
/* to cause the code to call the hook function to be compiled */
/* into the appropriate core function. */
/* */
/* ------------------------------------------------------------ */
/*** _board_init
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** This function is called from the core init() function.
** This can be used to perform any board specific init
** that needs to be done when the processor comes out of
** reset and before the user sketch is run.
*/
#if (OPT_BOARD_INIT != 0)
void _board_init(void) {
// Turn Secondary oscillator off as GPIO is needed
OSCCONCLR = _OSCCON_SOSCEN_MASK;
}
#endif
/* ------------------------------------------------------------ */
/*** _board_pinMode
**
** Parameters:
** pin - digital pin number to configure
** mode - mode to which the pin should be configured
**
** Return Value:
** Returns 0 if not handled, !0 if handled.
**
** Errors:
** none
**
** Description:
** This function is called at the beginning of the pinMode
** function. It can perform any special processing needed
** when setting the pin mode. If this function returns zero,
** control will pass through the normal pinMode code. If
** it returns a non-zero value the normal pinMode code isn't
** executed.
*/
#if (OPT_BOARD_DIGITAL_IO != 0)
int _board_pinMode(uint8_t pin, uint8_t mode) {
return 0;
}
#endif
/* ------------------------------------------------------------ */
/*** _board_getPinMode
**
** Parameters:
** pin - digital pin number
** mode - pointer to variable to receive mode value
**
** Return Value:
** Returns 0 if not handled, !0 if handled.
**
** Errors:
** none
**
** Description:
** This function is called at the beginning of the getPinMode
** function. It can perform any special processing needed
** when getting the pin mode. If this function returns zero,
** control will pass through the normal getPinMode code. If
** it returns a non-zero value the normal getPinMode code isn't
** executed.
*/
#if (OPT_BOARD_DIGITAL_IO != 0)
int _board_getPinMode(uint8_t pin, uint8_t * mode) {
return 0;
}
#endif
/* ------------------------------------------------------------ */
/*** _board_digitalWrite
**
** Parameters:
** pin - digital pin number
** val - value to write to the pin
**
** Return Value:
** Returns 0 if not handled, !0 if handled.
**
** Errors:
** none
**
** Description:
** This function is called at the beginning of the digitalWrite
** function. It can perform any special processing needed
** in writing to the pin. If this function returns zero,
** control will pass through the normal digitalWrite code. If
** it returns a non-zero value the normal digitalWrite code isn't
** executed.
*/#if (OPT_BOARD_DIGITAL_IO != 0)
int _board_digitalWrite(uint8_t pin, uint8_t val) {
return 0;
}
#endif
/* ------------------------------------------------------------ */
/*** _board_digitalRead
**
** Parameters:
** pin - digital pin number
** val - pointer to variable to receive pin value
**
** Return Value:
** Returns 0 if not handled, !0 if handled.
**
** Errors:
** none
**
** Description:
** This function is called at the beginning of the digitalRead
** function. It can perform any special processing needed
** in reading from the pin. If this function returns zero,
** control will pass through the normal digitalRead code. If
** it returns a non-zero value the normal digitalRead code isn't
** executed.
*/
#if (OPT_BOARD_DIGITAL_IO != 0)
int _board_digitalRead(uint8_t pin, uint8_t * val) {
return 0;
}
#endif
/* ------------------------------------------------------------ */
/*** _board_analogRead
**
** Parameters:
** pin - analog channel number
** val - pointer to variable to receive analog value
**
** Return Value:
** Returns 0 if not handled, !0 if handled.
**
** Errors:
** none
**
** Description:
** This function is called at the beginning of the analogRead
** function. It can perform any special processing needed
** in reading from the pin. If this function returns zero,
** control will pass through the normal analogRead code. If
** it returns a non-zero value the normal analogRead code isn't
** executed.
*/
#if (OPT_BOARD_ANALOG_READ != 0)
int _board_analogRead(uint8_t pin, int * val) {
return 0;
}
#endif
/* ------------------------------------------------------------ */
/*** _board_analogReference
**
** Parameters:
**
** Return Value:
** Returns 0 if not handled, !0 if handled.
**
** Errors:
** none
**
** Description:
** This function is called at the beginning of the analogReference
** function. It can perform any special processing needed
** to set the reference voltage. If this function returns zero,
** control will pass through the normal analogReference code. If
** it returns a non-zero value the normal analogReference code isn't
** executed.
*/
#if (OPT_BOARD_ANALOG_READ != 0)
int _board_analogReference(uint8_t mode) {
return 0;
}
#endif
/* ------------------------------------------------------------ */
/*** _board_analogWrite
**
** Parameters:
** pin - pin number
** val - analog value to write
**
** Return Value:
** Returns 0 if not handled, !0 if handled.
**
** Errors:
** none
**
** Description:
** This function is called at the beginning of the analogWrite
** function. It can perform any special processing needed
** in writing to the pin. If this function returns zero,
** control will pass through the normal analogWrite code. If
** it returns a non-zero value the normal analogWrite code isn't
** executed.
*/
#if (OPT_BOARD_ANALOG_WRITE != 0)
int _board_analogWrite(uint8_t pin, int val) {
return 0;
}
#endif
#endif // OPT_BOARD_DATA
/* ------------------------------------------------------------ */
#endif // BOARD_DATA_C
/************************************************************************/
+431
Ver Arquivo
@@ -0,0 +1,431 @@
/************************************************************************/
/* */
/* Board_Defs.h -- CmodCK1 Board Customization Declarations */
/* */
/************************************************************************/
/* Author: Gene Apperson */
/* Copyright 2011, Digilent. All rights reserved */
/************************************************************************/
/* File Description: */
/* */
/* This file contains the board specific declartions and data structure */
/* to customize the chipKIT MPIDE for use with a CmodCK1 board using a */
/* PIC32 part in a 44-pin package. */
/* */
/* This code is based on earlier work: */
/* Copyright (c) 2010, 2011 by Mark Sproul */
/* Copyright (c) 2005, 2006 by David A. Mellis */
/* */
/************************************************************************/
/* Revision History: */
/* */
/* 10/07/2011(GeneA): Created */
/* 11/28/2011(GeneA): Moved data definitions and configuration */
/* functions to Board_Data.c */
/* 11/29/2011(GeneA): Moved int priority definitions to System_Defs.h */
/* 01/23/2013(KeithV): Modified for CK1 board */
/* 03/26/2013(KeithV): Modified for DP32 board */
/* 05/27/2013(ClaudiaGoga): Fixed MISO, MOSI definitions. */
/* Added definitions to support PPS for SPI1 */
/* */
/************************************************************************/
//* This library is free software; you can redistribute it and/or
//* modify it under the terms of the GNU Lesser General Public
//* License as published by the Free Software Foundation; either
//* version 2.1 of the License, or (at your option) any later version.
//*
//* This library is distributed in the hope that it will be useful,
//* but WITHOUT ANY WARRANTY; without even the implied warranty of
//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
//* Lesser General Public License for more details.
//*
//* You should have received a copy of the GNU Lesser General
//* Public License along with this library; if not, write to the
//* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
//* Boston, MA 02111-1307 USA
/************************************************************************/
#if !defined(BOARD_DEFS_H)
#define BOARD_DEFS_H
#include <inttypes.h>
/* ------------------------------------------------------------ */
/* Public Board Declarations */
/* ------------------------------------------------------------ */
/* The following define symbols that can be used in a sketch to
** refer to periperhals on the board generically.
*/
// #define _BOARD_NAME_ "chipKIT DP32"
#define _BOARD_NAME_ "OpenBCI 32"
/* Define the peripherals available on the board.
*/
#define NUM_DIGITAL_PINS 19
#define NUM_ANALOG_PINS 9
#define NUM_OC_PINS 5
#define NUM_IC_PINS 5
#define NUM_TCK_PINS 5
#define NUM_INT_PINS 5
#define NUM_SERIAL_PORTS 2
#define NUM_SPI_PORTS 2
#define NUM_I2C_PORTS 2
#define NUM_DSPI_PORTS 2
#define NUM_DTWI_PORTS 2
/* Define I/O devices on the board.
*/
#define NUM_LED 4
#define NUM_BTN 2
#define NUM_SWT 0
#define NUM_SERVO 0
/* ------------------------------------------------------------ */
/* LED Declarations */
/* ------------------------------------------------------------ */
/* Define the pin numbers for the LEDs
*/
#define PIN_LED1 14 // 14 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
#define PIN_LED2 13 // 13 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
#define PIN_LED3 12 // 12 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
#define PIN_LED4 11 // 11 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
/* ------------------------------------------------------------ */
/* Button Declarations */
/* ------------------------------------------------------------ */
/* One button (PRG) for this board
*/
#define PIN_BTN1 17 // 17 RB4 SOSCI/RPB4/RB4
#define PIN_BTN2 1 // 1 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
/* Also define the virutal program button for soft reset */
#define USE_VIRTUAL_PROGRAM_BUTTON 1
#define VIRTUAL_PROGRAM_BUTTON_TRIS TRISBbits.TRISB4
#define VIRTUAL_PROGRAM_BUTTON LATBbits.LATB4
/* ------------------------------------------------------------ */
/* Switch Declarations */
/* ------------------------------------------------------------ */
/* No switches on this board.
*/
/* ------------------------------------------------------------ */
/* Servo Pin Declarations */
/* ------------------------------------------------------------ */
/* No servo connectors on this board.
*/
/* ------------------------------------------------------------ */
/* Timer Pin Declarations */
/* ------------------------------------------------------------ */
#define PIN_OC1 8 // B15 RPB15R = 5
#define PIN_OC2 2 // B8 RPB8R = 5
#define PIN_OC3 3 // B9 RPB9R = 5
#define PIN_OC4 13 // B2 RPB2R = 5
#define PIN_OC5 6 // B13 RPB13R = 6
#define PIN_IC1 6 // RB13 IC1R = RPB13 = 3
#define PIN_IC2 11 // B0 IC2R = RPB0 = 2
#define PIN_IC3 2 // B8 IC3R = RPB8 = 4
#define PIN_IC4 14 // B3 IC4R = RPB3 = 1
#define PIN_IC5 13 // RB2 IC5R = RPB2 = 4
#define PIN_TCK1 18 // A4, non PPS
#define PIN_TCK2 14 // B3 T2CKR = RPB3 = 1
#define PIN_TCK3 12 // B1 T3CKR = RPB1 = 2
#define PIN_TCK4 6 // B13 T4CKR = RPB13 = 3
#define PIN_TCK5 3 // B9 T5CKR = RPB9 = 4
/* ------------------------------------------------------------ */
/* Interrupt Pin Declarations */
/* ------------------------------------------------------------ */
#define PIN_INT0 1 // RB7 non-PPS
#define PIN_INT1 3 // B9 INT1R = RPB9 = 4
#define PIN_INT2 13 // B2 INT2R = RPB2 = 4
#define PIN_INT3 2 // B8 INT3R = RPB8 = 4
#define PIN_INT4 17 // B4 INT4R = RPB4 = 2
/* ------------------------------------------------------------ */
/* SPI Pin Declarations */
/* ------------------------------------------------------------ */
/* These symbols are defined for compatibility with the original
** SPI library and the original pins_arduino.h.
*/
const static uint8_t SS = 9; // RA0 CS1 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
const static uint8_t MISO = 10; // RA1 SDI1 SDI1R = RPA1 = 0
const static uint8_t MOSI = 18; // RA4 SDO1 RPA4R = SDO1 = 3
const static uint8_t SCK = 7; // RB14 SCK1 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
/* The Digilent DSPI library uses these ports.
*/
#define PIN_DSPI0_SS 8 // was 9 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
#define PIN_DSPI1_SS 14 // 14 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
/* ------------------------------------------------------------ */
/* Analog Pins */
/* ------------------------------------------------------------ */
/* Define symbols for accessing the analog pins. This table is
** used to map an analog pin number to the corresponding digital
** pin number.
*/
#define A0 6 // RB13 AN11/RPB13/CTPLS/PMRD/RB13
#define A1 7 // RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
#define A2 8 // RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
#define A3 9 // RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
#define A4 10 // RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
#define A5 11 // RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
#define A6 12 // RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
#define A7 13 // RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
#define A8 14 // RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
/* ------------------------------------------------------------ */
/* Change Notice Pins */
/* ------------------------------------------------------------ */
/* These define the pin numbers for the various change notice
** pins.
*/
#define PIN_CN0 0 // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
#define PIN_CN1 1 // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
#define PIN_CN2 2 // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
#define PIN_CN3 3 // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
#define PIN_CN4 4 // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
#define PIN_CN5 5 // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
#define PIN_CN6 6 // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
#define PIN_CN7 7 // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
#define PIN_CN8 8 // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
#define PIN_CN9 9 // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
#define PIN_CN10 10 // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
#define PIN_CN11 11 // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
#define PIN_CN12 12 // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
#define PIN_CN13 13 // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
#define PIN_CN14 14 // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
#define PIN_CN15 15 // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
#define PIN_CN16 16 // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
#define PIN_CN17 17 // 17 J3-9 RB4 SOSCI/RPB4/RB4
#define PIN_CN18 18 // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
/* ------------------------------------------------------------ */
/* Pin Mapping Macros */
/* ------------------------------------------------------------ */
/* Macros used to access the port and pin mapping tables.
** These are mostly generic, but some of them may be board specific.
** These perform slightly better as macros compared to inline functions
*/
#undef digitalPinToAnalog
#define digitalPinToAnalog(P) ( digital_pin_to_analog_PGM[P] )
#undef analogInPinToChannel
#define analogInPinToChannel(P) ( analog_pin_to_channel_PGM[P] )
/* ------------------------------------------------------------ */
/* Data Definitions */
/* ------------------------------------------------------------ */
/* The following declare externals to access the pin mapping
** tables. These tables are defined in Board_Data.c.
*/
#if !defined(OPT_BOARD_DATA)
extern const uint32_t port_to_tris_PGM[];
extern const uint8_t digital_pin_to_port_PGM[];
extern const uint16_t digital_pin_to_bit_mask_PGM[];
extern const uint16_t digital_pin_to_timer_PGM[];
extern const uint8_t digital_pin_to_pps_out_PGM[];
extern const uint8_t digital_pin_to_pps_in_PGM[];
extern const uint8_t digital_pin_to_analog_PGM[];
extern const uint8_t analog_pin_to_channel_PGM[];
extern const uint8_t output_compare_to_digital_pin_PGM[];
extern const uint8_t external_int_to_digital_pin_PGM[];
#endif
/* ------------------------------------------------------------ */
/* Internal Declarations */
/* ------------------------------------------------------------ */
/* The following declarations are used to map peripherals for */
/* the core and libraries and to provide configuration options */
/* for the core. They are not normally needed by a user sketch. */
/* ------------------------------------------------------------ */
#if defined(OPT_BOARD_INTERNAL)
/* ------------------------------------------------------------ */
/* Core Configuration Declarations */
/* ------------------------------------------------------------ */
/* */
/* These are conditional compilation switches that control the */
/* board core configuration functions. These functions provide */
/* hooks that can call from some of the core functions into */
/* functions defined below that can be used to extend or */
/* replace the default behavior of the core function. To use */
/* this, enter the appropriate code into the appropriate */
/* function skeleton below and then set the appropriate switch */
/* value to 1. This will cause the configuration function to be */
/* compiled into the build and will cause the code to call the */
/* hook function to be compiled into the core function. */
/* */
/* ------------------------------------------------------------ */
#define OPT_BOARD_INIT 1 //board needs special init code
#define OPT_BOARD_DIGITAL_IO 0 //board does not extend digital i/o functions
#define OPT_BOARD_ANALOG_READ 0 //board does not extend analogRead
#define OPT_BOARD_ANALOG_WRITE 0 //board does not extend analogWrite
/* ------------------------------------------------------------ */
/* Serial Port Declarations */
/* ------------------------------------------------------------ */
/* Serial port 0 uses UART1 – for the serial monitor
*/
#define _SER0_BASE _UART1_BASE_ADDRESS
#define _SER0_IRQ _UART1_ERR_IRQ
#define _SER0_VECTOR _UART_1_VECTOR
#define _SER0_IPL_ISR _UART1_IPL_ISR
#define _SER0_IPL _UART1_IPL_IPC
#define _SER0_SPL _UART1_SPL_IPC
#define _SER0_TX_OUT PPS_OUT_U1TX // RPB3R = U1TX = 1
#define _SER0_TX_PIN 14 // RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
#define _SER0_RX_IN PPS_IN_U1RX // U1RXR = RPB13 = 3
#define _SER0_RX_PIN 6 // RB13 AN11/RPB13/CTPLS/PMRD/RB13
/* Serial port 1 uses UART2
*/
#define _SER1_BASE _UART2_BASE_ADDRESS
#define _SER1_IRQ _UART2_ERR_IRQ
#define _SER1_VECTOR _UART_2_VECTOR
#define _SER1_IPL_ISR _UART2_IPL_ISR
#define _SER1_IPL _UART2_IPL_IPC
#define _SER1_SPL _UART2_SPL_IPC
#define _SER1_TX_OUT PPS_OUT_U2TX // RPB14R = U2TX = 2
#define _SER1_TX_PIN 7 // RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
#define _SER1_RX_IN PPS_IN_U2RX // U2RXR = RPA1 = 0
#define _SER1_RX_PIN 10 // RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
/* ------------------------------------------------------------ */
/* SPI Port Declarations */
/* ------------------------------------------------------------ */
/* The default SPI port uses SPI1.
*/
#define _SPI_BASE _SPI1_BASE_ADDRESS
#define _SPI_ERR_IRQ _SPI1_ERR_IRQ
#define _SPI_RX_IRQ _SPI1_RX_IRQ
#define _SPI_TX_IRQ _SPI1_TX_IRQ
#define _SPI_VECTOR _SPI_1_VECTOR
#define _SPI_IPL_ISR _SPI1_IPL_ISR
#define _SPI_IPL _SPI1_IPL_IPC
#define _SPI_SPL _SPI1_SPL_IPC
/* SPI pin declarations
*/
#define _SPI_MISO_IN PPS_IN_SDI1
#define _SPI_MISO_PIN MISO
#define _SPI_MOSI_OUT PPS_OUT_SDO1
#define _SPI_MOSI_PIN MOSI
/* SPI1
*/
// RA0 CS1 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
// RA4 SDO1 RPA4R = SDO1 = 3
// RA1 SDI1 SDI1R = RPA1 = 0
// RB14 SCK1 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
#define _DSPI0_BASE _SPI1_BASE_ADDRESS
#define _DSPI0_ERR_IRQ _SPI1_ERR_IRQ
#define _DSPI0_RX_IRQ _SPI1_RX_IRQ
#define _DSPI0_TX_IRQ _SPI1_TX_IRQ
#define _DSPI0_VECTOR _SPI_1_VECTOR
#define _DSPI0_IPL_ISR _SPI1_IPL_ISR
#define _DSPI0_IPL _SPI1_IPL_IPC
#define _DSPI0_SPL _SPI1_SPL_IPC
#define _DSPI0_MISO_IN PPS_IN_SDI1
#define _DSPI0_MISO_PIN 5 // was 10 RA1 SDI1 SDI1R = RPA1 = 0
#define _DSPI0_MOSI_OUT PPS_OUT_SDO1
#define _DSPI0_MOSI_PIN 10 // was 18 RA4 SDO1 RPA4R = SDO1 = 3
/* SPI2
*/
// RB4 CS2 SOSCI/RPB4/RB4
// RB8 SDO2 RPB8R = SDO2 = 4
// RB2 SDI2 SDI2R = RPB2 = 4
// RB15 SCK2 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
#define _DSPI1_BASE _SPI2_BASE_ADDRESS
#define _DSPI1_ERR_IRQ _SPI2_ERR_IRQ
#define _DSPI1_RX_IRQ _SPI2_RX_IRQ
#define _DSPI1_TX_IRQ _SPI2_TX_IRQ
#define _DSPI1_VECTOR _SPI_2_VECTOR
#define _DSPI1_IPL_ISR _SPI2_IPL_ISR
#define _DSPI1_IPL _SPI2_IPL_IPC
#define _DSPI1_SPL _SPI2_SPL_IPC
#define _DSPI1_MISO_IN PPS_IN_SDI2
#define _DSPI1_MISO_PIN 13 // RB2 SDI2 SDI2R = RPB2 = 4
#define _DSPI1_MOSI_OUT PPS_OUT_SDO2
#define _DSPI1_MOSI_PIN 2 // RB8 SDO2 RPB8R = SDO2 = 4
/* ------------------------------------------------------------ */
/* I2C Port Declarations */
/* ------------------------------------------------------------ */
/* The standard I2C1 port uses I2C1 (SCL1/SDA1).
** RB8/RB9 pins 38/4
*/
#define _TWI_BASE _I2C1_BASE_ADDRESS
#define _TWI_BUS_IRQ _I2C1_BUS_IRQ
#define _TWI_SLV_IRQ _I2C1_SLAVE_IRQ
#define _TWI_MST_IRQ _I2C1_MASTER_IRQ
#define _TWI_VECTOR _I2C_1_VECTOR
#define _TWI_IPL_ISR _I2C1_IPL_ISR
#define _TWI_IPL _I2C1_IPL_IPC
#define _TWI_SPL _I2C1_SPL_IPC
/* Declarations for Digilent DTWI library.
** DTWI0 is on RB8/RB9 pins 38/4
*/
#define _DTWI0_BASE _I2C1_BASE_ADDRESS
#define _DTWI0_BUS_IRQ _I2C1_BUS_IRQ
#define _DTWI0_SLV_IRQ _I2C1_SLAVE_IRQ
#define _DTWI0_MST_IRQ _I2C1_MASTER_IRQ
#define _DTWI0_VECTOR _I2C_1_VECTOR
#define _DTWI0_IPL_ISR _I2C1_IPL_ISR
#define _DTWI0_IPL _I2C1_IPL_IPC
#define _DTWI0_SPL _I2C1_SPL_IPC
/* Declarations for Digilent DTWI library.
** DTWI0 is on RB8/RB9 pins 38/4
*/
#define _DTWI1_BASE _I2C2_BASE_ADDRESS
#define _DTWI1_BUS_IRQ _I2C2_BUS_IRQ
#define _DTWI1_SLV_IRQ _I2C2_SLAVE_IRQ
#define _DTWI1_MST_IRQ _I2C2_MASTER_IRQ
#define _DTWI1_VECTOR _I2C_2_VECTOR
#define _DTWI1_IPL_ISR _I2C2_IPL_ISR
#define _DTWI1_IPL _I2C2_IPL_IPC
#define _DTWI1_SPL _I2C2_SPL_IPC
/* ------------------------------------------------------------ */
/* A/D Converter Declarations */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
#endif // OPT_BOARD_INTERNAL
/* ------------------------------------------------------------ */
#endif // BOARD_DEFS_H
/************************************************************************/
+37
Ver Arquivo
@@ -0,0 +1,37 @@
############################################################
openbci.name=OpenBCI 32
openbci.group=chipKIT
# new items
openbci.platform=pic32
openbci.board=_BOARD_DP32_
openbci.board.define=-D_USE_USB_FOR_SERIAL_
openbci.ccflags=-Map="map.map"
openbci.ldscript=chipKIT-application-32MX250F128.ld
# end of new items
# Use a high -Gnum for devices that have less than 64K of data memory
# For -G1024, objects 1024 bytes or smaller will be accessed by
# gp-relative addressing
openbci.compiler.c.flags=-O2::-c::-mno-smart-io::-w::-ffunction-sections::-fdata-sections::-G1024::-g::-mdebugger::-Wcast-align::-fno-short-double
openbci.compiler.cpp.flags=-O2::-c::-mno-smart-io::-w::-fno-exceptions::-ffunction-sections::-fdata-sections::-G1024::-g::-mdebugger::-Wcast-align::-fno-short-double
openbci.upload.protocol=stk500v2
# 128KB - 4K for EEPROM - 4K for bootloader
openbci.upload.maximum_size=122880
openbci.upload.speed=115200
openbci.bootloader.low_fuses=0xff
openbci.bootloader.high_fuses=0xdd
openbci.bootloader.extended_fuses=0x00
openbci.bootloader.path=not-supported
openbci.bootloader.file=not-supported
openbci.bootloader.unlock_bits=0x3F
openbci.bootloader.lock_bits=0x0F
openbci.build.mcu=32MX250F128B
openbci.build.f_cpu=40000000L
openbci.build.core=pic32
openbci.build.variant=OpenBCI
############################################################