How to get device revision?

Discussions around product based on ARM Cortex M0+ core.

Moderator: nferre

Posts: 14
Joined: Fri Dec 02, 2011 12:40 am

How to get device revision?

Sat Mar 19, 2016 6:24 pm

We are using SAMD20J18 devices in our sensor products. In the datasheet there is an Errata in chapter 35 with a paragraph for each device revision that was released by Atmel. Where can I read the device revision from a specific device? Which register should I read? (when I search the entire datasheet for 'revision' there seem to be quite a lot revisions in this device...)
Posts: 68
Joined: Mon Jan 26, 2015 2:33 pm

Re: How to get device revision?

Mon Apr 04, 2016 9:08 am

Hi Robbie

[Edited 2016/04/04 14:55 GMT+2]
Aha! My local FAE was wrong about only being able to get the revision from the lot number on the box! I found this in the system_clock_source_dfll_set_config function from clock.c... because the DFLL course setting value is only valid from revision C onwards, so they have to check it. NB! This is therefore making use of the ASF, but you can pick appart the code - it reads a register and just masks it as you would expect:

Code: Select all

	/* Get MCU revision */
	uint32_t rev = system_get_device_id();

	rev = rev >> DSU_DID_REVISION_Pos;

	if (rev < _SYSTEM_MCU_REVISION_D) {
		_system_clock_inst.dfll.val =
				_SYSTEM_OLD_DFLLVAL_COARSE(config->coarse_value) |
	} else {
		_system_clock_inst.dfll.val =
				_SYSTEM_NEW_DFLLVAL_COARSE(config->coarse_value) |
In my case, the issue I had was in the section where you select the MUX combinations for SPI ports (Master Mode Settings) Mux/Pad 'A' to 'H' is fine, but for combos 'I' through 'P' there is a footnote (1) that says "Not available in all silicon revisions". With no further explanation.

I subsequently discovered that the SPI port was just ignoring my setup commands, as I was trying to use mode 'N'. I changed to mode 'E', re-routed my connections, and it suddenly worked. Frustrating it was!

Go well.

Return to “SAM D20 Cortex-M0+ MCU”

Who is online

Users browsing this forum: No registered users and 1 guest