Go Down

Topic: Floating Point Unit support (Read 1 time) previous topic - next topic

dlabun

@westfw, According to Atmel the biggest difference is that the E series has the Ethernet and CAN controllers while the D series does not.

MartinL

#16
Sep 20, 2017, 02:08 pm Last Edit: Sep 20, 2017, 02:11 pm by MartinL
I amended the _U and _L macro names in the SAMD51 Atmel CMSIS file to _UI (unsigned int) and _SL (signed long) respectively.

A blank sketch (empty setup() and loop()) now compiles without warnings or errors.

The SAMD51D20A chips I ordered have arrived.

MartinL

Adafruit have now added support for the SAMD51's hardware FPU.

dlabun

Thanks for the update... I wonder if that's a sign they are going to be releasing their boards soon.

MartinL

#19
Sep 28, 2017, 10:22 am Last Edit: Sep 28, 2017, 10:34 am by MartinL
Finally managed to get the SAMD51J20A working with the Arduino IDE.

It'll certainly be interesting to see how this 120MHz, ARM-Cortex M4F microcontroller performs.

This is all thanks to the engineering effort by Adafruit, building upon the considerable work carried out by Arduino for the SAMD21 and in many ways shows the benefits, (at least in this instance), of open source development.

Getting it going at this early stage of development was quite involved though, I need to:

1) Zip up Adafruit's SAMD51 code and write a JSON file, to create a new entry in the Arduino IDE boards manager, so that the new board and code could be installed.

2) Copy the modified "sam.h" and "samd.h", as well as add the "samd51" directory from Adafruit's Atmel CMSIS Github repository, to the Arduino IDE's Atmel CMSIS directory.

3) Copy Adafruit's modified bossac executable found their SAMD51 code's "Tools" directory, to replace the Arduino IDE's "bossac.exe" file in its "1.7.0" directory.

4) Upload the bootloader to the SAMD51 board using an Atmel ICE programmer and Atmel Studio (Tools->Device Programming->Memories), then selecting the path to the "samdx1_sam_ba.bin" bootloader file.

As the code is still under development, I'd suggest that it's probably easiest to wait until Adafruit's Metro M4 board becomes available and there's full support for the Arduino IDE.

In terms of hardware, I simply soldered the 64-pin, SAMD51J20A in a TQFP package to my custom board designed for the SAMD21J18A. The main difference is that SAMD51's VDDCORE pin is located two pins down with respect to the SAMD21 and that it's now recommended to connect a 4.7uF capacitor from this pin to ground, rather than the 1uF that was there for the SAMD21. This just required a slight modification replacing the capacitor and re-routing it to the new VDDCORE pin.

I'm now rewriting the "variant.cpp" files to recofigure the pin functions, as my custom board more closely matches the Arduino Zero, rather than the Metro M4.

Quote
Thanks for the update... I wonder if that's a sign they are going to be releasing their boards soon.
Adafruit are currently saying that the Metro M4 is scheduled for November. Hmm..., perhaps one to add to my Santa's wish list?

westfw

Quote
Zip up Adafruit's SAMD51 code and write a JSON file, to create a new entry in the Arduino IDE boards manager, so that the new board and code could be installed.
You don't HAVE to have a JSON file.   You can still copy new directories into the hardware/ tree directly.  I've got a 1.8.2 IDE with espressif ESP32 and SAMD11 boards added that way...


MartinL

#21
Sep 28, 2017, 04:36 pm Last Edit: Sep 28, 2017, 04:37 pm by MartinL
Quote
You don't HAVE to have a JSON file.   You can still copy new directories into the hardware/ tree directly.  I've got a 1.8.2 IDE with espressif ESP32 and SAMD11 boards added that way...
Thanks for this information. I didn't know that simply copying the files would work.

I did try to copy the files across at the start, but I guess I must have placed them in the incorrect directory, as they weren't picked up by the IDE and I ended up going down the unnecessary harder route, (not for the first time).

This certainly simplifies this first step.

westfw

Speaking of the SAMD51, I've been putting together this spreadsheet describing the available pin functions:
Google Docs SAMD51 Pinout
I find it especially useful to be able to sort on a particular columns; otherwise it's mostly a copy of the table from section 6.1 of the manual.
(Light gray sections are incomplete, and/or copied from a similar SAMD21 spreadsheet (and thus perhaps inaccurate.)

MartinL

#23
Oct 03, 2017, 11:13 am Last Edit: Oct 03, 2017, 11:47 am by MartinL
Thank you for your spreadsheet. With the port pins in ascending order, I find it much easier to read than the datasheet table.

So far I've successfully tried out the I2C Wire library and SerialUSB with the SAMD51. I managed to get it reading back raw accelerometer/gyroscope values from a MPU-9250 sensor, using the I2C bus in fast mode (400kHz) and displaying them on the Arduino IDE console.

I also replicated the test that Limor Fried did in her Adafruit video about the SAMD51, using successive calls to the OUTTGL (output toggle) register, to bit bang the GPIO output at 30MHz!

The SAMD51 also offers more in the way of timers and channels, the SAMD51J20A has 6, 16-bit TC timers (TC0...TC5) with two channels each. In addition, it has 5 TCC timer channels for PWM (TCC0..TCC4), with 6, 4, 3, 2 and 2 channels respectively. This is in addition to the standard on-chip Systick and RTC timers.

There is one issue however and it's to do with the SERCOM Tx pin on the SAMD51. On each SERCOM there are are 4 pads (0..3) that in the case of the USART configuration can be assigned to TX, RX, CTS and RTS, and for the SPI configuration to SCLK, MISO, MOSI and SS.

The SERCOM peripherals' pads are located on the same pins on both the SAMD21 and SAMD51 devices. On the SAMD21 it's possible to mix 'n' match practically any SERCOM signal to any pad. On the SAMD51 however, while the RX/MISO signal can be assigned to any pad, the USART's TX output is limited to the pin at pad 0 and the SPI's MOSI can only output on the pin at pads 0 or 3.

The consequence is that if you're designing a custom board using SAMD51, it limits the flexibility of which pins you can use as a USART TX or SPI MOSI. It also reduces the viability of the SAMD51 as a simple plug in replacement for the SAMD21.

Overall though, I guess this slight reduction in pin flexibility is a small price to pay for the SAMD51's increase in performance.

westfw

Quote
The SERCOM peripherals' pads are located on the same pins on both the SAMD21 and SAMD51 devices. On the SAMD21 it's possible to mix 'n' match practically any SERCOM signal to any pad. On the SAMD51 however, while the RX/MISO signal can be assigned to any pad, the USART's TX output is limited to the pin at pad 0
Huh.  I had noticed that UART TX was limited to Pad0, but not that this was different than the SAMD21.  (come on.  a Sercom should be the same on all devices!  Grr...)  Even on the D21, you only have a choice between Pad0 and Pad2, so it's still not great...

Go Up