1

I am looking for a reference document or documentation system that concretely relates at minimum:

  • Screen printed pin name/number
  • SAM3X8E pin number
  • Register number
  • Channel number
  • Port name

In my case I am looking to change the PWM characteristics of pins 2 and 3 (as named on the physical board). Various forum posts discuss setting registers, register pin mappings, but nothing seems to quite tie up.

On the Arduino as printed, Pins 2 to 13 are listed as PWM pins, 12 in total. By this page, pins 2 and 3 map to PB25 and PC28 respectively on the SAM3X8E chip. Presumably this suggests Pin 2 is on the 'B' port, and 3 is on the 'C' port. Referencing this page, the sample code goes through 'all 8' PWM ports and pins, which by the register naming scheme PIO_ASBR_Pxx, suggests the pins numbered 16 to 19 are on the B Port, and 21 to 24 are on the 'C' port. Later the PWM ports are again iterated over with the PWM->PWM_CH_NUM[i] where i runs from 0 to PWMCH_NUM_NUMBER - 1, which is suggested as 8 in total.

'Pin 2' on the board then seems to have a mapping to a named pin on the Atmel chip of PB25, somewhere between 21 and 24 on the register name and between 0 and 7 on the channel index. Surely there is a place that attempts to harmonise all of these disparate naming conventions.

Further Information:

For instance, PWM/Digital Pin 2 maps to PB25 on the chip, as per the schematic provided by Majenko. PB25 is not a member of the PWM pins as per the chip datasheet. How am I to understand this?

When referencing the name PIO_ASBR_19, this is the 20th bit in the PIO_ASBR register, but how does this bit map onto the port/pin mapping? Then while the datasheet discusses the 'PIO_ASBR' register, since that can relate to at most 32 pins, the datasheet does not expand on how to map the excess pins.

13
  • The name -> pin -> port/bit mapping can be got from the schematic. The PWM mappings of channel -> pin can be got from the SAM3X8E datasheet.
    – Majenko
    Feb 4, 2022 at 14:39
  • 1
    in Arduino store: content.arduino.cc/assets/Pinout-Due_latest.pdf
    – Juraj
    Feb 4, 2022 at 14:46
  • Forgive my simplicity, but it looks like both references, the schematic and the pinout, simply relate the screen printed pin names with the P[A|B|C|D][dd] notation. When I review the (enormous) chip datasheet, I cannot find the majority of the register definitions required to map back to the pin notation. Could you help me interpret that document?
    – J Collins
    Feb 4, 2022 at 14:59
  • 1
    PC7 is Port C bit 7. There's nothing much to interpret. For special peripherals like PWM you just look them up in the port multiplexing table (section 9.3).
    – Majenko
    Feb 4, 2022 at 16:15
  • @Juraj I can see there is a lot of information, but it still seems to fail to identify 1) What PWM ID (i=0..7) Pin 2 corresponds to, which bit the pin is in any register (16..19, 21..24).
    – J Collins
    Feb 4, 2022 at 16:58

1 Answer 1

1

The full pinout is available on arduino.cc in Store and in the Getting started section.

For instance, PWM/Digital Pin 2 maps to PB25 on the chip. PB25 is not a member of the PWM pins as per the chip datasheet. How am I to understand this?

The Arduino core uses timers to do PWM on pins without native PWM support.

In analogWrite source code you can see sections for DAC, PWM and TIMER PWM pins.

The information about pins for Arduino core is in variant.cpp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.