Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
fd50d90
fix makefile for easier programming
ladyada Oct 28, 2015
11fa3d3
pulse D13 LED during bootloader active
ladyada Oct 31, 2015
85d6c73
makefile now compiles from within Roaming/Arduino15 subfolder
ladyada Oct 31, 2015
e715bf3
add support for A6 (D8) and A7 (D9)
ladyada Nov 1, 2015
f851644
bootloader with different VID/PID
ladyada Nov 1, 2015
def75fa
adds bootloaders/feather
toddtreece Nov 17, 2015
9ad4e0d
reverts bootloaders/zero changes
toddtreece Nov 17, 2015
d5cda2b
Merge branch 'master' of github.com:arduino/ArduinoCore-samd
toddtreece Nov 17, 2015
e7579eb
adds new boards.txt
toddtreece Nov 18, 2015
22f47bb
Update platform.txt
ladyada Nov 24, 2015
bf20844
Merge branch 'master' of github.com:arduino/ArduinoCore-samd
ladyada Nov 24, 2015
5c7319f
make it so native USB is Serial
ladyada Jan 13, 2016
d8f4306
Serial5 not available anyhow
ladyada Jan 24, 2016
d95e053
Update Board for Feather M0
obsoleted Feb 10, 2016
c34dd05
Keep ARDUINO_SAMD_ZERO flag for compatilibity
obsoleted Feb 11, 2016
9d193cc
add metro m0 (testing)
ladyada Feb 14, 2016
440afc5
add USB CDC RX & TX LEDs with 10ms minimum on time, tested
ladyada Feb 14, 2016
616475a
fix random init() call, set debug output to Serial1
ladyada Feb 15, 2016
ae5e0b8
use Serial1 option for debug output (since USB port is taken)
ladyada Feb 15, 2016
e25840e
manually did https://github.com/arduino/ArduinoCore-samd/pull/88 and …
ladyada Feb 15, 2016
f41f197
Working demo with nice status change notifications
ladyada Feb 15, 2016
188d880
woot, that wasnt too bad - updated debug for Serial1, works nicely
ladyada Feb 15, 2016
21b53d1
Merge pull request #1 from obsoleted/board_featherm0
ladyada Feb 17, 2016
a2024c7
Merge branch 'master' of https://github.com/arduino/ArduinoCore-samd …
ladyada Mar 4, 2016
0303c16
merge with upstream, pulse LED & VID/PID change for bootloader
ladyada Mar 6, 2016
83834c3
feather bootloader files
ladyada Mar 6, 2016
58392be
fixed up DAC refs
ladyada Apr 16, 2016
9b72387
cleaned up slight difference in USB union bitflags with a new USBDevi…
ladyada Apr 16, 2016
72f6d46
well, it compiles now!
ladyada Apr 16, 2016
bdabb74
clumsy but has correct bossac and can upload&reset ( it seems )
ladyada Apr 18, 2016
340ad50
stashing - still need to do the variant!
ladyada May 10, 2016
402a502
Merge branch 'master' of https://github.com/arduino/ArduinoCore-samd
ladyada May 14, 2016
f8734ea
make readme less confusing, so people dont think its the official core!
ladyada May 14, 2016
3277492
bump version!
ladyada May 14, 2016
25cd637
Merge branch 'master' into atsamr
ladyada May 14, 2016
b467584
missing DAC0 def fix
ladyada May 14, 2016
433f644
Merge branch 'master' into atsamr
ladyada May 14, 2016
ebaf3bc
first pass at variant. Serial1 on sercom5, SPI on sercom 2 working
ladyada May 14, 2016
03844b1
SPI1 tested & works
ladyada May 15, 2016
b923678
radio workin, all pins accounted for
ladyada May 20, 2016
71c6f9d
align back to mainline (and put in missing Serial5) - not sure if USB…
ladyada May 20, 2016
b86cc80
Merge branch 'master' into atsamr
ladyada May 23, 2016
51f6ca8
comment out radio but fix adc support in zero on the extra pins
ladyada Jun 22, 2016
f0d0188
bump platform version
ladyada Jun 23, 2016
e8c4141
fix platform path
ladyada Jun 23, 2016
6bef47d
mac bossac
ladyada Jun 24, 2016
5b1108c
Added bossac_osx with +x privilege.
tdicola Jun 24, 2016
45c9d5b
Tweak platform.txt to use OSX bossac.
tdicola Jun 24, 2016
f8b1ce3
add linux bossac
Jun 24, 2016
f6d0aaf
revert platform, will try again later :/
ladyada Jun 24, 2016
fed20f6
Fix for PWM on many pins, now works on: 5, 6, 9, 10, 11, 12, 13, 15 (…
ladyada Jul 25, 2016
488ed7f
re-fix analog 6 & 7
ladyada Aug 3, 2016
c569975
another A6/A7 fix
ladyada Aug 3, 2016
cfd2cca
bump version
ladyada Aug 3, 2016
732aefc
unknown change but commiting anyhow (we dont use the files)
ladyada Jan 15, 2017
af9e214
Merge remote-tracking branch 'upstream/master'
ladyada Jan 15, 2017
9712b43
oops fix merge conflict
ladyada Jan 15, 2017
c6ba693
rev D hardware match
ladyada Jan 18, 2017
d05675d
fix pid for bootloader
ladyada Jan 18, 2017
67599aa
add qtouch library and linking
ladyada Jan 25, 2017
cb3aea3
add metro m0 variant
ladyada Jan 31, 2017
590c97f
Merge remote-tracking branch 'upstream/master'
ladyada Feb 1, 2017
16d8216
add SPI flash SS pin
ladyada Feb 3, 2017
eef984e
fix analog pins, I2S not working yet
ladyada Feb 8, 2017
427725a
Merge remote-tracking branch 'upstream/master'
ladyada Feb 23, 2017
da00e39
fix for quote-needing paths
ladyada Feb 27, 2017
fbc2a13
bigger buffer for Wire
ladyada Feb 27, 2017
0acb9be
ignore emacs saves
ladyada Mar 19, 2017
92aec3e
new variant for feather m0 express (it has second SPI port)
ladyada Mar 19, 2017
ca16afe
fix SPI1 - tested
ladyada Mar 19, 2017
e7f2b53
bump version!
ladyada Mar 21, 2017
8578ec2
oops, forgot!
ladyada Mar 21, 2017
858d176
re-bump
ladyada Mar 21, 2017
94786e9
update for rev F - we'll manually config i2s since we dont need an fs…
ladyada Apr 14, 2017
8012aac
rev g varianty
ladyada Apr 21, 2017
10a9c83
Merge remote-tracking branch 'upstream/master'
ladyada Apr 21, 2017
8a921a4
Tweak the DFLL crystal-less startup sequence to more reliably start.
tannewt Apr 25, 2017
e61846f
nicer #Defines
ladyada Apr 27, 2017
eb7b6da
bump version
ladyada May 8, 2017
d1cf9ff
right variant to match rev G
ladyada Jun 23, 2017
ba140a7
unknown why but if pin has analog set it variant, pwm doesnt work. ju…
ladyada Jun 29, 2017
c1831f1
removed unneeded libs
ladyada Jun 29, 2017
5a01c5e
bump!
ladyada Jun 29, 2017
99001c0
no longer needed
ladyada Jun 29, 2017
37b9881
DM: added samd51 support
deanm1278 Jun 30, 2017
2b7298e
Update README.md
deanm1278 Jun 30, 2017
24a653d
Add Gemma m0 - tested just about everything
ladyada Jul 1, 2017
62bf9f8
DM: fixed pwm and dac (almost)
deanm1278 Jul 3, 2017
fb6f09a
Update README.md
deanm1278 Jul 3, 2017
6d06982
Allow attachInterrupt() on NMI pin (PA08 on ATSAMD21E)
PaintYourDragon Feb 14, 2017
04e3b13
DM: fix switching between dac output and analogread
deanm1278 Jul 7, 2017
1c33cd2
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Jul 7, 2017
887a448
DM: fixed tone
deanm1278 Jul 7, 2017
7a363cc
Update README.md
deanm1278 Jul 7, 2017
7e76b3c
DM: clocked to 120MHZ, peripherals to 100, USB to 48
deanm1278 Jul 11, 2017
31aecad
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Jul 11, 2017
5c7e00e
DM: mostly fixed usb enumeration delay
deanm1278 Jul 25, 2017
ce608f2
DM: added support for samd51J20A
deanm1278 Aug 1, 2017
f741c82
trinket m0 start
ladyada Aug 1, 2017
e8f2213
rename and assign VID/PID
ladyada Aug 2, 2017
5a0bf8a
DM: added metro m4 variant
deanm1278 Aug 4, 2017
dd7d17e
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Aug 4, 2017
de847a1
add gemma & trinket m0
ladyada Aug 6, 2017
236fe64
DM: variant changes got bonked
deanm1278 Aug 31, 2017
c0272da
DM: fixed i2c pins
deanm1278 Aug 31, 2017
04731bc
not having any SPI breaks things - maybe just have a 'fake' sck+mosi …
ladyada Sep 17, 2017
c0c9ba0
DM: fixed DAC, SPI
deanm1278 Sep 20, 2017
13707df
DM: added FPU support
deanm1278 Sep 20, 2017
01232bf
DM: bugfixes
deanm1278 Sep 21, 2017
2789053
DM: in progress i2s / dma support
deanm1278 Sep 22, 2017
0da4144
DM: lets not feed PLLs from xosc
deanm1278 Sep 25, 2017
3461ace
DM: oops committed wrong stuff, actually fixed DPLL problems
deanm1278 Sep 25, 2017
cfa521c
DM: not crystalless
deanm1278 Sep 25, 2017
e42ab7b
DM: fixed SERCOM baud rates
deanm1278 Sep 25, 2017
da3291d
DM: updated bootloader size to 16k, fixed USB vid/pid
deanm1278 Oct 4, 2017
3d72ce6
DM: fixed VID/PID
deanm1278 Oct 4, 2017
fb41af4
DM: fixed dpll1 freq
deanm1278 Oct 4, 2017
6826404
DM: update sercom IRQs for M4
deanm1278 Oct 10, 2017
c3b70d0
DM: fixed ADC channel
deanm1278 Oct 10, 2017
169c784
DM: fixed USB enumeration bug in bootloader and core
deanm1278 Oct 11, 2017
e131567
Update README.md
deanm1278 Oct 11, 2017
63ba6aa
DM: EIC and VARIANT_MCK fix
deanm1278 Oct 13, 2017
e8b316c
DM: adding feather m4
deanm1278 Oct 13, 2017
5871530
working on getting sercoms working. i2c OK. serial is not :(
ladyada Oct 14, 2017
2b39437
fix numbering for soft-SPI (tested)
ladyada Oct 14, 2017
13e2406
DM: update m4 bootloader for multiple targets
deanm1278 Oct 16, 2017
7bae00e
DM: updates for rev B
deanm1278 Oct 17, 2017
ceafcf8
DM: temp fix for rando failure bug, turn off C optimizations for now
deanm1278 Oct 17, 2017
45f3eeb
DM: updated variant for rev B
deanm1278 Oct 17, 2017
c62a2be
Update README.md
deanm1278 Oct 17, 2017
4f072bc
DM: fix upload bug
deanm1278 Oct 18, 2017
70066a8
Update README.md
deanm1278 Oct 18, 2017
32d321b
move feather m0 out to its own variant and fix D8/D9 PWM/analog mixup
ladyada Oct 20, 2017
3506e15
fix for Feather M0 #9 PWM
ladyada Oct 20, 2017
2d8ca01
updated install procedure
ladyada Oct 22, 2017
caf2363
~markdown~
ladyada Oct 22, 2017
765a5de
rephrase
ladyada Oct 22, 2017
f80cf3b
DM: fix analog correction library
deanm1278 Oct 24, 2017
b8042c4
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Oct 24, 2017
6ead93c
DM: some usb host fixes (still not working)
deanm1278 Oct 24, 2017
fb5de48
Update README.md
deanm1278 Oct 24, 2017
4f22a07
DM: fix tone 0 frequency
deanm1278 Oct 24, 2017
ca58c2f
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Oct 24, 2017
b425bcd
Update README.md
jerryneedell Oct 27, 2017
3826294
Update README.md
jerryneedell Oct 27, 2017
8f2c6a1
Update README.md
jerryneedell Oct 27, 2017
1070407
Merge pull request #17 from jerryneedell/samd51
ladyada Oct 28, 2017
a84b050
Update README.md
jerryneedell Oct 29, 2017
92dc436
Update README.md
jerryneedell Oct 29, 2017
ace678a
Update README.md
jerryneedell Oct 29, 2017
b000142
Update README.md
jerryneedell Oct 29, 2017
a19d197
Update README.md
jerryneedell Oct 29, 2017
74d6d1b
Update README.md
jerryneedell Oct 29, 2017
99e8fe9
Update README.md
jerryneedell Oct 29, 2017
7abe4a1
Merge pull request #18 from jerryneedell/samd51
ladyada Oct 29, 2017
03590c5
DM: we have a 12 bit dac lets use
deanm1278 Oct 30, 2017
e8b4580
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Oct 30, 2017
4f128a7
DM: fix worst bug in entire world
deanm1278 Nov 3, 2017
a75e94f
DM: updated magic number to match circuitpython stuff
deanm1278 Nov 6, 2017
ed2087b
DM: updated feather m4 variant for new rev
deanm1278 Nov 7, 2017
fb82965
add itsybitsy m0 variant (commented out) and bootloaders for all
ladyada Nov 12, 2017
5d4285e
DM: fixed math lib paths for m0 boards
deanm1278 Nov 20, 2017
7f275e1
DM: added math libraries
deanm1278 Dec 5, 2017
fa63c67
DM: some I2S stuff
deanm1278 Dec 13, 2017
7f3c9f0
DM: fixed m0 boards compilation error with math additions
deanm1278 Dec 18, 2017
9ba241a
DM: update feather m4 variant
deanm1278 Dec 22, 2017
9349090
DM: fix typo in cplay express boards.txt
deanm1278 Jan 3, 2018
6fc17a3
DM: fix linker vfp arguments
deanm1278 Jan 4, 2018
c00e68d
add itsybitsy (needs PID update before release)
ladyada Jan 27, 2018
db3f0db
Update itsybitsy for USB PIDs!
ladyada Feb 2, 2018
69071fd
bump to add itsy
ladyada Feb 7, 2018
6c0f402
prelim pirkey config
ladyada Mar 16, 2018
d27f766
update usb stuff
deanm1278 Mar 20, 2018
78d9fbe
update pinout and stuff for new revision
deanm1278 Mar 20, 2018
bdcc18d
DM: update feather m4 pinout for new rev
deanm1278 Mar 27, 2018
70c5f9c
DM: fix feather m4 variant
deanm1278 Mar 28, 2018
aebe54b
DM: update pwms for samd51
deanm1278 Mar 29, 2018
f5093b6
start of pirkey
ladyada Mar 29, 2018
ad797c1
fix correct IRQ #'s (see DS) not a full sweep, just did pins that wer…
ladyada Mar 29, 2018
a222c14
DM: fix delay microseconds
deanm1278 Apr 2, 2018
d1b7b57
Merge branch 'samd51' of github.com:adafruit/ArduinoCore-samd into sa…
deanm1278 Apr 2, 2018
d184519
DM: update interrupt numbers on metro m4
deanm1278 Apr 2, 2018
965af33
DM: remove incorrect pins comment
deanm1278 Apr 2, 2018
625fd55
Merge branch 'master' of github.com:adafruit/ArduinoCore-samd
deanm1278 Apr 2, 2018
6180dcb
Merge branch 'samd51'
deanm1278 Apr 2, 2018
04618d7
DM: delete mistake file
deanm1278 Apr 2, 2018
59de275
Merge pull request #32 from adafruit/merge-samd51
ladyada Apr 2, 2018
1c1cb3e
Update README.md
ladyada Apr 2, 2018
040bda6
DM: fix interrupts, pcc pins
deanm1278 Apr 5, 2018
b16a801
updated for neopixel to be on #40 like the silkscreen
ladyada Apr 9, 2018
c3f1fa4
fix math.h complaints
ladyada Apr 9, 2018
f41c917
add PWMs on pin 0, 1, A3, A4 - tested!
ladyada Apr 10, 2018
bd0c38e
update cmsis-atmel and bossac path (we'll see!)
ladyada Apr 10, 2018
06ca7be
update for new bossac
ladyada Apr 10, 2018
e4a41f3
lets start with two versions, we can bump up bossac for everything el…
ladyada Apr 10, 2018
a91e014
DM: fix dac not holding value bug
deanm1278 Apr 16, 2018
f01d4ce
DM: fix dac clock and first write bug
deanm1278 Apr 16, 2018
9064f83
we have lots o pins >.<
ladyada Apr 20, 2018
88395d6
removed unused .a and fixed frequency
ladyada Apr 23, 2018
e47bcbd
DM: fix some pwms
deanm1278 Apr 26, 2018
8543148
Merge branch 'master' of github.com:adafruit/ArduinoCore-samd
deanm1278 Apr 26, 2018
fab83cf
update clocks to match arduino samd
deanm1278 Apr 30, 2018
42aa484
DM: update pwms, timer definitions
deanm1278 Apr 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
well, it compiles now!
  • Loading branch information
ladyada committed Apr 16, 2016
commit 72f6d467c16363948b30b7dbc0d8737b8e199192
9 changes: 7 additions & 2 deletions bootloaders/feather/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ else
CFLAGS+=-Os -DDEBUG=0
endif

CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x0B -DUSB_VID_LOW=0x9A -DUSB_VID_HIGH=0x23
# Adafruit Feather Zero (0x239A 0x000B)
#CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x0B -DUSB_VID_LOW=0x9A -DUSB_VID_HIGH=0x23
# Adafruit Feather SAMR (0x239A 0x0014)
CFLAGS_EXTRA?=-D__SAMR21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x14 -DUSB_VID_LOW=0x9A -DUSB_VID_HIGH=0x23
# Arduino Zero (PID == 0x004D)
# CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x4D -DUSB_VID_LOW=0x41 -DUSB_VID_HIGH=0x23
# Genuino Zero (PID == 0x024D)
Expand All @@ -78,6 +81,9 @@ CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x0B -DUSB_VID_
# Genuino MKR1000 (PID == 0x024E)
# CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x02 -DUSB_PID_LOW=0x4E -DUSB_VID_LOW=0x41 -DUSB_VID_HIGH=0x23

# samd or samr
NAME=samr21_sam_ba

INCLUDES=-I"$(MODULE_PATH)/tools/CMSIS/4.0.0-atmel/CMSIS/Include/" -I"$(MODULE_PATH)/tools/CMSIS/4.0.0-atmel/Device/ATMEL/"

# -----------------------------------------------------------------------------
Expand All @@ -102,7 +108,6 @@ sam_ba_serial.c
OBJECTS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.o))
DEPS=$(addprefix $(BUILD_PATH)/, $(SOURCES:.c=.d))

NAME=samd21_sam_ba
ELF=$(NAME).elf
BIN=$(NAME).bin
HEX=$(NAME).hex
Expand Down
47 changes: 41 additions & 6 deletions bootloaders/feather/board_driver_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,22 @@ uint32_t USB_Write(Usb *pUsb, const char *pData, uint32_t length, uint8_t ep_num
/* Set the multi packet size as zero for multi-packet transfers where length > ep size */
usb_endpoint_table[ep_num].DeviceDescBank[1].PCKSIZE.bit.MULTI_PACKET_SIZE = 0;
/* Clear the transfer complete flag */
//pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT1 = true;

#ifdef __SAMR21G18A__
pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT1 = true;
#else
pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT |= (1<<1);
#endif

/* Set the bank as ready */
pUsb->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.bit.BK1RDY = true;

/* Wait for transfer to complete */
#ifdef __SAMR21G18A__
while ( (pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT1) == 0 );
#else
while ( (pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT & (1<<1)) == 0 );
#endif

return length;
}
Expand All @@ -205,15 +214,22 @@ uint32_t USB_Read(Usb *pUsb, char *pData, uint32_t length)
}

/* Check for Transfer Complete 0 flag */
#ifdef __SAMR21G18A__
if ( pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT0 )
#else
if ( pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT & (1<<0) )
#endif
{
/* Set packet size */
packetSize = SAM_BA_MIN(usb_endpoint_table[USB_EP_OUT].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT, length);
/* Copy read data to user buffer */
memcpy(pData, udd_ep_out_cache_buffer[USB_EP_OUT-1], packetSize);
/* Clear the Transfer Complete 0 flag */
//pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT0 = true;
#ifdef __SAMR21G18A__
pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT0 = true;
#else
pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT |= (1 << 0);
#endif
/* Clear the user flag */
read_job = false;
}
Expand All @@ -240,10 +256,16 @@ uint32_t USB_Read_blocking(Usb *pUsb, char *pData, uint32_t length)
/* Clear the bank 0 ready flag */
pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPSTATUSCLR.bit.BK0RDY = true;
/* Wait for transfer to complete */

#ifdef __SAMR21G18A__
while (!( pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT0 ));
/* Clear Transfer complete 0 flag */
pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT0 = true;
#else
while (!( pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT & (1<<0) ));
/* Clear Transfer complete 0 flag */
//pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT0 = true;
pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT |= (1 << 0);
#endif

return length;
}
Expand Down Expand Up @@ -303,14 +325,20 @@ void USB_SendStall(Usb *pUsb, bool direction_in)
if (direction_in)
{
/* Set STALL request on IN direction */
//pUsb->DEVICE.DeviceEndpoint[0].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ1;
#ifdef __SAMR21G18A__
pUsb->DEVICE.DeviceEndpoint[0].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ1;
#else
pUsb->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.STALLRQ = (1<<1);
#endif
}
else
{
/* Set STALL request on OUT direction */
//pUsb->DEVICE.DeviceEndpoint[0].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ0;
#ifdef __SAMR21G18A__
pUsb->DEVICE.DeviceEndpoint[0].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ0;
#else
pUsb->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.STALLRQ = (1<<0);
#endif
}
}

Expand All @@ -322,12 +350,19 @@ void USB_SendZlp(Usb *pUsb)
/* Set the byte count as zero */
usb_endpoint_table[0].DeviceDescBank[1].PCKSIZE.bit.BYTE_COUNT = 0;
/* Clear the transfer complete flag */
//pUsb->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.TRCPT1 = true;
#ifdef __SAMR21G18A__
pUsb->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.TRCPT1 = true;
#else
pUsb->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.TRCPT |= (1 << 1);
#endif
/* Set the bank as ready */
pUsb->DEVICE.DeviceEndpoint[0].EPSTATUSSET.bit.BK1RDY = true;
/* Wait for transfer to complete */
#ifdef __SAMR21G18A__
while (!( pUsb->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.TRCPT1 ));
#else
while (!( pUsb->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.TRCPT & (1<<1) ));
#endif
}

/*----------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions bootloaders/feather/sam_ba_cdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ bool cdc_is_rx_ready(/*P_USB_CDC pCdc*/void)
return 0;

/* Return transfer complete 0 flag status */
#ifdef __SAMR21G18A__
return (pCdc->pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT0);
#else
return (pCdc->pUsb->DEVICE.DeviceEndpoint[USB_EP_OUT].EPINTFLAG.bit.TRCPT & (1<<0));
#endif
}

uint32_t cdc_write_buf(/*P_USB_CDC pCdc,*/ void const* data, uint32_t length)
Expand Down
42 changes: 37 additions & 5 deletions bootloaders/feather/sam_ba_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,19 @@ void sam_ba_usb_CDC_Enumerate(P_USB_CDC pCdc)
{
if (dir)
{
//wStatus = (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.reg & USB_DEVICE_EPSTATUSSET_STALLRQ1) ? 1 : 0;
#ifdef __SAMR21G18A__
wStatus = (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.reg & USB_DEVICE_EPSTATUSSET_STALLRQ1) ? 1 : 0;
#else
wStatus = (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.bit.STALLRQ & (1<<1)) ? 1 : 0;
#endif
}
else
{
//wStatus = (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.reg & USB_DEVICE_EPSTATUSSET_STALLRQ0) ? 1 : 0;
#ifdef __SAMR21G18A__
wStatus = (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.reg & USB_DEVICE_EPSTATUSSET_STALLRQ0) ? 1 : 0;
#else
wStatus = (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.bit.STALLRQ & (1<<0)) ? 1 : 0;
#endif
}
/* Return current status of endpoint */
USB_Write(pCdc->pUsb, (char *) &wStatus, sizeof(wStatus), USB_EP_CTRL);
Expand Down Expand Up @@ -315,13 +321,19 @@ void sam_ba_usb_CDC_Enumerate(P_USB_CDC pCdc)
/* Set STALL request for the endpoint */
if (dir)
{
//pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ1;
#ifdef __SAMR21G18A__
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ1;
#else
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSSET.bit.STALLRQ = (1<<1);
#endif
}
else
{
//pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ0;
#ifdef __SAMR21G18A__
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ0;
#else
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSSET.bit.STALLRQ = (1<<0);
#endif
}

/* Send ZLP */
Expand Down Expand Up @@ -353,21 +365,40 @@ void sam_ba_usb_CDC_Enumerate(P_USB_CDC pCdc)
{
if (dir)
{
#ifdef __SAMR21G18A__
if (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.bit.STALLRQ1)
{
// Remove stall request
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_STALLRQ1;
if (pUsb->DEVICE.DeviceEndpoint[wIndex].EPINTFLAG.bit.STALL1)
{
pUsb->DEVICE.DeviceEndpoint[wIndex].EPINTFLAG.bit.STALL1 = 1;
#else

if (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.bit.STALLRQ & (1<<1))
{
// Remove stall request
//pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_STALLRQ1;
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSCLR.bit.STALLRQ = (1<<1);
if (pUsb->DEVICE.DeviceEndpoint[wIndex].EPINTFLAG.bit.STALL & (1<<1))
{
pUsb->DEVICE.DeviceEndpoint[wIndex].EPINTFLAG.bit.STALL = (1<<1);
#endif
// The Stall has occurred, then reset data toggle
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSSET_DTGLIN;
}
}
}
else
{
#ifdef __SAMR21G18A__
if (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.bit.STALLRQ0)
{
// Remove stall request
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_STALLRQ0;
if (pUsb->DEVICE.DeviceEndpoint[wIndex].EPINTFLAG.bit.STALL0)
{
pUsb->DEVICE.DeviceEndpoint[wIndex].EPINTFLAG.bit.STALL0 = 1;
#else
if (pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUS.bit.STALLRQ & (1<<0))
{
// Remove stall request
Expand All @@ -376,6 +407,7 @@ void sam_ba_usb_CDC_Enumerate(P_USB_CDC pCdc)
if (pUsb->DEVICE.DeviceEndpoint[wIndex].EPINTFLAG.bit.STALL & (1<<0))
{
pUsb->DEVICE.DeviceEndpoint[wIndex].EPINTFLAG.bit.STALL = (1<<0);
#endif
// The Stall has occurred, then reset data toggle
pUsb->DEVICE.DeviceEndpoint[wIndex].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSSET_DTGLOUT;
}
Expand Down
Binary file added bootloaders/feather/samr21_sam_ba.bin
Binary file not shown.
Loading