Arduino Code로 테스트 하면 이미 작성되어 있는 라이브러리가 많아서 간단하게 테스트 하기에 좋은것 같다.
그래서 SAMD21E EVM 보드에 아두이노 부트로더를 올려 보았다.
#SAMD21E-S EVM 보드에 ATSAMD21 Arduino Bootloader 를 넣었더니 USB인식은 하는데 실제 Arduino IDE에서 구동하면 프로그램이 동작을 하지 않는다.
ATSAMD21A 기준으로 작성된 bootloader라서 그런가... variant.cpp 파일을 수정 해 주어야 하나?
ATSAMD21A 와 ATSAMD21E 용량 차이 때문에 그런것 같다.
https://github.com/mattairtech/ArduinoCore-samd 에 SAMD21E를 이용하여 작성한 bootloader가 있다.
https://github.com/mattairtech/ArduinoCore-samd/tree/master/bootloaders/zero/binaries
mattairtech/ArduinoCore-samd
This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain Arduino support for SAM D|L|C (M0+ and M4F) boards including the MattairTech Xeno Mini and the MT-D21E (see htt...
github.com
보드 메니저 에서 MattairTech SAM D|L|C Core for Arduino를 검색해서 설치 한다.
보드를 선택하고 Microcontroller를 ATSAMD21E를 선택 해 준다.
기본 코드 작성해서 구동하니 정상적으로 동작 한다.
다만 LED에 연결된 포트가 variants 에 정의 되어 있지 않아서 그냥 로레벨 함수로 제어 해 보았다.
#define Led1Off() PORT->Group[0].OUTCLR.reg = (1<<27)
#define Led1On() PORT->Group[0].OUTSET.reg = (1<<27)
// the setup routine runs once when you press reset:
void setup()
{
PORT->Group[0].DIRSET.reg = (1 << 27);
PORT->Group[0].OUTSET.reg = (1 << 27);
}
// the loop routine runs over and over again forever:
void loop()
{
Led1On();
delay(100);
Led1Off();
delay(100);
}