Page 1 of 1
Using LXSAMD21DMX with Adafruit Feather M0
Posted: Fri Feb 22, 2019 3:13 am
by ariherzig
Hello,
I'm looking to try and use your library with an Adafruit Feather M0. I'm a little confused by what pins on the Feather that I should be using. I'm not sure if the pins I need are exposed on the Feather, and if not I'm a bit confused as to how to set them up. I'd appreciate any help you can give.
Thanks,
Ari
Posted: Sat Feb 23, 2019 2:42 pm
by admin
Can you post a link to the exact board that you are asking about? There are now quite a few Feathers that have an SAMD21 M0 processor.
The MCU pins may be brought out differently depending on the design of the board. That, in turn, determines which SERCOM module you might want to use. Each SECOM can have its TX (and RX) assigned to one of two pins. Conveniently, Adafruit has an article about how this works:
https://learn.adafruit.com/using-atsamd ... new-serial
The header for the LXSAMD21DMX library has an optional macro towards the bottom of the file that switches between SERCOM4 (the default) and SERCOM2. The default uses Arduino pins 4 and 5, TX/RX. The alternate SERCOM2 uses 4 and 3.
The MCU's SERCOM modules are not only used by UART type serial communication but also for SPI, I2C, etc. So, an additional consideration is if you are using a library that needs a specific SERCOM for one of these as well.
Posted: Sat Feb 23, 2019 5:17 pm
by ariherzig
I'm using the Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0
https://www.adafruit.com/product/2772
I'm new to going this deep into the board config, but from what I can tell, I don't have access to pins 3 and 4. Would I be able to configure it to use SERCOM 1 and use pins 10 and 11?
I'm using the Adafruit Motor Shield V2 library to control two steppers. I think it only uses Arduino pins 20 and 21 for I2C.
Thank you for your help.
Posted: Sat Feb 23, 2019 5:54 pm
by admin
I added optional macro definitions for SERCOM1 pins 10 and 11. I don't have an Adafruit board to test these. But, you can try and let me know. To use the optional macros, uncomment line 521 of src/LXSAMD21DMX.h, setting use_optional_sercom_macros to 2.
Posted: Sat Feb 23, 2019 8:48 pm
by ariherzig
It works! Thank you so much for your help with this. It's people like you that remind me that there are good people out there.