I have a project that was developed originally for the Arduino One, but I was forced to move to Arduino Zero because of the small memory fotprint in the ATMEL ATMEGA328 Microcontroller.
The Arduino Zero has an ICSP header identical to the one used in older AVR Arduino Board (2x3 pins).
I have a USBasp AVR Programmer that I used to flash my programs in the Arduino one directly without the Arduino bootloader, it is the USBASP model: http://www.fischl.de/usbasp/
- Would I be able to use this Programmer to flash my program in the Arduino Zero (ATMEL SAMD architecture) instead of using the USB ports?. The ICSP headers are at least phisically compatible in Arduino One and Zero.
My second question is related to the Sercom serial interfaces in the atmel SAMD21 series, and the possiblity to use two SPI interfaces. According my readings in this forum the six SERCOM (Serial communication) modules available are used in the Arduino Zero in the following way:
SERCOM0 -> USART (Native USB PORT???)
SERCOM1 -> Free by default
SERCOM2 -> Free by default
SERCOM3 -> I2C pins (SDA + SCL) / wire library
SERCOM4 -> SPI (ICSP Connector) / SPI Library
SERCOM5 -> USART (for Atmel EDBG) / Programming port
That means there is only one SPI port available in the Arduino Zero. There are however many comments in the forum about the possibiity of using two SPI ports in Arduino Zero.
- Can I use the SPI port available (SERCOM4 in the ICSP connector) to communicate with two different ICs?, in my case a display and an SD Card controller. I would select PIN10 as CS (Chip Select) to select the SD Card controller, and another Digital output to select the display in order to communicate with them. Is this possible?
Otherwise, is it possible using Processing / Arduino IDE to cconfigure one of the available SERCOM to configure a second SPI bus?
Thank you in advanced for any advice or hint.
- Would I be able to use this Programmer to flash my program in the Arduino Zero (ATMEL SAMD architecture) instead of using the USB ports?.
No. The SAMD21 uses different protocols for programming, and you CAN NOT use the ISP header to do it. The connector is maintained to accomodate those shields that use the ISP connector as a board-independent SPI connector. (ie, MEGA, Uno, and Zero have SPI on different digitial pins, but they all have SPI on the ISP connector.)
On the Uno, the 6 pin ICSP header is connected to digital pins 11-13 and is used both as an SPI port and for programming.
On the Zero, the 6 pin ICSP header is separate from the digital pins 11-13. The ICSP header is used as an SPI port that can be controlled with Arduino's SPI library, but unlike the Uno it can't be used to program the Zero's SAMD21 microcontroller. That's done using the small 10 pin SWD header on the right hand side of the board, just beneath the ICSP header. On the Arduino.cc's Zero this header isn't fitted, on the Arduino.org's Zero Pro/M0 Pro it is.
Regarding the programmer the AVR one won't work, you'll need an Atmel SAM ICE programmer instead. As the Zero's EBDG chip allows you to program and debug the Zero anyway and the fact that the Zero's memory is much greater than the Uno's, there's probably little advantage in using one. Unless of course you intend to make your own custom boards?
Yes, as you suggest SPI can be used to connect to more than one device and that each device requires its own chip select signal. Although some devices may have differing SPI clock speed requirements.
Yes, the Sercoms can be configured to be an I2C, SPI or USART, so it's possible to have a second SPI. I believe there's working being carried out on this at the moment. On a recent discussion Dirk67 supplied a link to github here: Add Sercom defs for SPI and Wire in variant by aethaniel · Pull Request #24 · arduino/ArduinoCore-samd · GitHub.
Thank you, fantastic explanantion!.
I realized that the Arduino Zero uses avrdude to flash the program, and the zero bossa (based on Atmel Sam-Ba), and therefore the flash proces is not the same.
did you move to Arduino Zero ?
I'd like to share Zero experience.
I managed to port Atmel ASF SPI bootloader from SAMD20J18 to SAMD21G18...
Let me know where you are in your design