Skip to content

Commit 518ce47

Browse files
author
Mike Grusin
committed
1.4.0 Release
Updated SFE SAMD boards for 1.8+ Beta release of LilyPad LilyMini
1 parent 0cbde52 commit 518ce47

39 files changed

+508
-518
lines changed

IDE_Board_Manager/package_sparkfun_index.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@
268268
"category": "Contributed",
269269
"url": "https://github.com/sparkfun/Arduino_Boards/raw/LilyMini_testing/IDE_Board_Manager/sparkfun-samd-1.4.0.tar.bz2",
270270
"archiveFileName": "sparkfun-samd-1.4.0.tar.bz2",
271-
"checksum": "SHA-256:D2DBAFABE77F60A1A085A80DE3E086328681FE90F16D026B417554B3FB9EDFDD",
272-
"size": "288700",
271+
"checksum": "SHA-256:B3F09095478EFD13388E2A786021D2FC1C1FA7A6236CC7B28152E4DDB94561B2",
272+
"size": "289527",
273273
"help": {
274274
"online": "https://forums.sparkfun.com"
275275
},
827 Bytes
Binary file not shown.

README.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# SparkFun Arduino Boards
22

3-
This repository contains support for the following SparkFun Arduino-compatible development boards:
3+
This repository contains support for the following SparkFun Arduino-compatible development boards.
4+
5+
**IMPORTANT NOTE:** These board files have been updated for compatibility with Arduino version 1.8 and higher. Some boards (e.g. SAMD) may not compile correctly with earlier versions of Arduino. If you need compatibility with earlier versions of Arduino, you can choose previous releases of these boards from the Boards Manager.
46

57
#### AVR Boards
68

@@ -21,6 +23,7 @@ This repository contains support for the following SparkFun Arduino-compatible d
2123

2224
* [SparkFun SAMD21 Dev Breakout](https://www.sparkfun.com/products/13672)
2325
* [SparkFun SAMD21 Mini Breakout](https://www.sparkfun.com/products/13664)
26+
* [SparkFun 9DoF Razor IMU M0 (SAMD21)](https://www.sparkfun.com/products/14001)
2427
* [SparkFun LilyMini ProtoSnap (SAMD11)](https://www.sparkfun.com/products/14063)
2528
* [SparkFun LilyMini (SAMD11)](https://www.sparkfun.com/products/14064)
2629

@@ -29,37 +32,43 @@ This repository contains support for the following SparkFun Arduino-compatible d
2932
* [ESP8266 Thing](https://www.sparkfun.com/products/13231)
3033
* [ESP8266 WiFi Shield](https://www.sparkfun.com/products/13287)
3134

32-
Each board will be added as an entry to the Arduino **Tools** > **Board** menu.
33-
34-
![Example image](example.png)
35-
3635
### Installation Instructions
3736

38-
To add board support for our products, go to **File** > **Preferences**, and paste this URL into the 'Additional Boards Manager URLs' input field:
37+
To add board support for our products, start Arduino and open the Preferences window (**File** > **Preferences**). Now copy and paste the following URL into the 'Additional Boards Manager URLs' input field:
3938

4039
https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json
4140

42-
![Adding a board manager list](https://cdn.sparkfun.com/assets/learn_tutorials/4/5/4/arduino-board-add.png)
41+
![Location of Additional Boards Manager URL input field](prefs-arrow.png)
42+
43+
If there is already an URL from another manufacturer in that field, click the button at the right end of the field. This will open an editing window allowing you to paste the above URL onto a new line.
44+
45+
### AVR and ESP Installation Instructions
46+
47+
Open the Boards Manager window by selecting **Tools** > **Board**, scroll to the top of the board list, and select **Boards Manager**.
48+
49+
![Boards Manager Menu](manager-menu.png)
50+
51+
If you type "sparkfun" (without quotes) into the "filter your search" field, you will see options to install SparkFun's AVR and ESP board files. Click in the desired box, and click the "Install" button that appears. Once installed, the boards will appear at the bottom of the board list.
52+
53+
![Sparkfun Boards](sparkfunboards.png)
4354

44-
This field can be found in 'Preferences...' under the Arduino File menu.
55+
### SAMD Installation Instructions
4556

46-
Now, under the **Tools** > **Board** > **Boards Manager...**, if you type in "sparkfun", you will see an option to install board files for SparkFun Arduino compatible boards. Click "Install" to add these to your list.
57+
When installing SAMD boards, you will need to first install Arduino SAMD support, then SparkFun's SAMD boards.
4758

48-
**NOTE: If you are using Arduino 1.6.6 and the link isn't working for you, change "https" at the beginning of the link to "http" and try again. We're working to figure out why this is happening in version 1.6.6.**
59+
Open the Boards Manager window by selecting **Tools** > **Board**, scroll to the top of the board list, and select **Boards Manager**. Now type "samd" (without quotes) into the "filter your search" field at the top of the window. Two entries should show up, one for Arduino SAMD boards, and one for SparkFun SAMD boards. We'll install both of these, starting with Arduino SAMD boards.
4960

50-
![SparkFun Boards image](https://cdn.sparkfun.com/assets/learn_tutorials/4/5/4/sparkfun-arduino-board-install.png)
61+
Click anywhere in the "Arduino SAMD Boards" box, and click "Install". This is a large installation and will take a while.
5162

52-
Now, when you select the Boards list, you will see a collection of new boards for SparkFun.
63+
![Arduino SAMD Boards](manager-arrow.png)
5364

54-
![SparkFun Boards List](boards_list.png)
65+
Now click anywhere in the "SparkFun SAMD Boards" box, and click "Install". This is a small installation and will happen much faster.
5566

56-
### Cleaning up the Boards Menu
67+
![SparkFun SAMD Boards](manager-arrow2.png)
5768

58-
Each entry in the boards list is defined in [boards.txt](https://github.com/sparkfun/Arduino_Boards/blob/master/sparkfun/avr/boards.txt). If you want to de-clutter the menu, you can comment out a board by inserting a `#` at the beginning of each line.
69+
You're now ready to use SparkFun SAMD boards. They will appear at the bottom the board list.
5970

6071
### Notes
6172

62-
* **Please note: This will only work under Arduino IDE versions 1.5 and up.**
63-
* Some boards such as the Pro Micro and the Mega Pro come in more than one form. For these **you must select the correct processor** in the 'Tools' menu.
73+
* Some boards such as the Arduino Pro and Pro Mini come in more than one flavor. For these **you must select the correct processor** in the 'Tools' menu.
6474
* Information on compiling and programming the bootloaders can be found in the bootloaders directory.
65-
* **Bugs introduced in the Arduino IDE version 1.6.6 through at least 1.6.9 produce errors indicating there is something wrong with these files. This can be resolved by reverting back to 1.6.5-r5. So far all reports seem to indicated that 1.6.10 has also fixed the issues. These intermittent issues are difficult to reliably reproduce.**

SparkFunBoards.png

8.35 KB
Loading

boards_list.png

-51 KB
Binary file not shown.

example.png

-55 KB
Binary file not shown.

manager-arrow.png

69.3 KB
Loading

manager-arrow2.png

73.5 KB
Loading

manager-menu.png

54.4 KB
Loading

prefs-arrow.png

161 KB
Loading

sparkfun/samd/cores/arduino/Arduino.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ extern "C"{
5555

5656
void yield( void ) ;
5757

58+
/* system functions */
59+
int main( void );
60+
void init( void );
61+
5862
/* sketch */
5963
void setup( void ) ;
6064
void loop( void ) ;

sparkfun/samd/cores/arduino/Reset.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ extern "C" {
2424
#endif
2525

2626
#define NVM_MEMORY ((volatile uint16_t *)0x000000)
27+
28+
#if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10610)
29+
30+
extern const uint32_t __text_start__;
31+
#define APP_START ((volatile uint32_t)(&__text_start__) + 4)
32+
33+
#else
2734
#define APP_START 0x00002004
35+
#endif
2836

2937
static inline bool nvmReady(void) {
3038
return NVMCTRL->INTFLAG.reg & NVMCTRL_INTFLAG_READY;
@@ -35,6 +43,13 @@ static void banzai() {
3543
// Disable all interrupts
3644
__disable_irq();
3745

46+
// Avoid erasing the application if APP_START is < than the minimum bootloader size
47+
// This could happen if without_bootloader linker script was chosen
48+
// Minimum bootloader size in SAMD21 family is 512bytes (RM section 22.6.5)
49+
if (APP_START < (0x200 + 4)) {
50+
goto reset;
51+
}
52+
3853
// Erase application
3954
while (!nvmReady())
4055
;
@@ -44,6 +59,7 @@ static void banzai() {
4459
while (!nvmReady())
4560
;
4661

62+
reset:
4763
// Reset the device
4864
NVIC_SystemReset() ;
4965

sparkfun/samd/cores/arduino/SERCOM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ void SERCOM::enableSPI()
240240

241241
void SERCOM::disableSPI()
242242
{
243-
//Setting the enable bit to 0
244-
sercom->SPI.CTRLA.bit.ENABLE = 0;
245243

246244
while(sercom->SPI.SYNCBUSY.bit.ENABLE)
247245
{
248246
//Waiting then enable bit from SYNCBUSY is equal to 0;
249247
}
248+
//Setting the enable bit to 0
249+
sercom->SPI.CTRLA.bit.ENABLE = 0;
250250
}
251251

252252
void SERCOM::setDataOrderSPI(SercomDataOrder dataOrder)

sparkfun/samd/cores/arduino/USB/SAMD21_USBDevice.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class USBDevice_SAMD21G18x {
4848

4949
inline void runInStandby() { usb.CTRLA.bit.RUNSTDBY = 1; }
5050
inline void noRunInStandby() { usb.CTRLA.bit.RUNSTDBY = 0; }
51+
inline void wakeupHost() { usb.CTRLB.bit.UPRSM = 1; }
5152

5253
// USB speed
5354
inline void setFullSpeed() { usb.CTRLB.bit.SPDCONF = USB_DEVICE_CTRLB_SPDCONF_FS_Val; }
@@ -106,7 +107,7 @@ class USBDevice_SAMD21G18x {
106107
inline void epBank0EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL0 = 1; }
107108
inline void epBank1EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL1 = 1; }
108109
inline void epBank0EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT0 = 1; }
109-
inline void epBank1EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT0 = 1; }
110+
inline void epBank1EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT1 = 1; }
110111

111112
inline void epBank0DisableSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.RXSTP = 1; }
112113
inline void epBank0DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL0 = 1; }
@@ -318,21 +319,24 @@ class DoubleBufferedEPOutHandler : public EPHandler {
318319
usbd.epBank0AckTransferComplete(ep);
319320
//usbd.epBank0AckTransferFailed(ep); // XXX
320321

321-
// Update counters and swap banks
322+
// Update counters and swap banks for non-ZLP's
322323
if (incoming == 0) {
323324
last0 = usbd.epBank0ByteCount(ep);
325+
if (last0 != 0) {
324326
incoming = 1;
325327
usbd.epBank0SetAddress(ep, const_cast<uint8_t *>(data1));
326-
ready0 = true;
327328
synchronized {
329+
ready0 = true;
328330
if (ready1) {
329331
notify = true;
330332
return;
331333
}
332334
notify = false;
333335
}
336+
}
334337
} else {
335338
last1 = usbd.epBank0ByteCount(ep);
339+
if (last1 != 0) {
336340
incoming = 0;
337341
usbd.epBank0SetAddress(ep, const_cast<uint8_t *>(data0));
338342
synchronized {
@@ -344,6 +348,7 @@ class DoubleBufferedEPOutHandler : public EPHandler {
344348
notify = false;
345349
}
346350
}
351+
}
347352
release();
348353
}
349354
}

sparkfun/samd/cores/arduino/USB/USBAPI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class USBDeviceClass {
6565
bool configured();
6666
bool connected();
6767

68+
void standby();
69+
6870
// Setup API
6971
bool handleClassInterfaceSetup(USBSetup &setup);
7072
bool handleStandardSetup(USBSetup &setup);

sparkfun/samd/cores/arduino/USB/USBCore.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup)
250250
return true;
251251
}
252252

253+
void USBDeviceClass::standby() {
254+
usbd.noRunInStandby();
255+
}
256+
257+
253258
void USBDeviceClass::handleEndpoint(uint8_t ep)
254259
{
255260
#if defined(CDC_ENABLED)

sparkfun/samd/cores/arduino/USB/USBCore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ _Pragma("pack()")
258258
* idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
259259

260260
#define D_CONFIG(_totalLength,_interfaces) \
261-
{ 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED, USB_CONFIG_POWER_MA(500) }
261+
{ 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USB_CONFIG_POWER_MA(500) }
262262
/* Table 9-10. Standard Configuration Descriptor
263263
* bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
264264
* bmAttributes, bMaxPower */

sparkfun/samd/cores/arduino/USB/USBDesc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define CDC_TX CDC_ENDPOINT_IN
4242
#endif
4343

44-
#define ISERIAL_MAX_LEN 20
44+
#define ISERIAL_MAX_LEN 33
4545

4646
// Defined string description
4747
#define IMANUFACTURER 1

sparkfun/samd/cores/arduino/Uart.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Uart::Uart(SERCOM *_s, uint8_t _pinRX, uint8_t _pinTX, SercomRXPad _padRX, Serco
3131

3232
void Uart::begin(unsigned long baudrate)
3333
{
34-
begin(baudrate, (uint8_t)SERIAL_8N1);
34+
begin(baudrate, SERIAL_8N1);
3535
}
3636

3737
void Uart::begin(unsigned long baudrate, uint16_t config)

sparkfun/samd/cores/arduino/Udp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class UDP : public Stream {
4242

4343
public:
4444
virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
45+
virtual uint8_t beginMulticast(IPAddress, uint16_t) { return 0; } // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure
4546
virtual void stop() =0; // Finish with the UDP socket
4647

4748
// Sending UDP packets

sparkfun/samd/cores/arduino/cortex_handlers.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ void SysTick_Handler(void)
174174
SysTick_DefaultHandler();
175175
}
176176

177-
//static void (*usb_isr)(void) = NULL;
178-
//
179-
//void USB_Handler(void)
180-
//{
181-
// if (usb_isr)
182-
// usb_isr();
183-
//}
184-
//
185-
//void USB_SetHandler(void (*new_usb_isr)(void))
186-
//{
187-
// usb_isr = new_usb_isr;
188-
//}
177+
static void (*usb_isr)(void) = NULL;
178+
179+
void USB_Handler(void)
180+
{
181+
if (usb_isr)
182+
usb_isr();
183+
}
184+
185+
void USB_SetHandler(void (*new_usb_isr)(void))
186+
{
187+
usb_isr = new_usb_isr;
188+
}

sparkfun/samd/cores/arduino/itoa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ extern char* ltoa( long value, char *string, int radix )
122122
return string;
123123
}
124124

125-
extern char* utoa( unsigned long value, char *string, int radix )
125+
extern char* utoa( unsigned int value, char *string, int radix )
126126
{
127127
return ultoa( value, string, radix ) ;
128128
}

sparkfun/samd/cores/arduino/itoa.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extern "C"{
2626

2727
extern char* itoa( int value, char *string, int radix ) ;
2828
extern char* ltoa( long value, char *string, int radix ) ;
29-
extern char* utoa( unsigned long value, char *string, int radix ) ;
29+
extern char* utoa( unsigned int value, char *string, int radix ) ;
3030
extern char* ultoa( unsigned long value, char *string, int radix ) ;
3131

3232
#ifdef __cplusplus

0 commit comments

Comments
 (0)