I’m struggling to get UART/serial communication working on the Microchip SAM R34 with Atmel Studio 7.
I followed an example using CDC_SERCOM_MUX_SETTING and related PINMUX macros, but they seem invalid for SAM R34.
Has anyone successfully set up serial on the SAM R34, or cathey n point to correct configurations or examples?
I ran into the exact same issue with CDC_SERCOM_MUX_SETTING not working on the SAM R34. Turns out, a lot of examples floating around are for SAMD or SAMR30 chips.
What helped me was ditching ASF3 and switching to ASF4 (START-based projects). In Atmel START,
I manually configured the SERCOM instance (I used SERCOM0) with the proper pinmux settings, then generated the code.
That way, I avoided relying on hardcoded macros that don’t apply to the SAM R34. After that, UART just started working as expected!
Same boat here! What finally worked for me was digging into the LoRaWAN example projects from Microchip’s GitHub.
One of the SAM R34 examples actually had USART configured correctly for console output.
I copied the usart_config
struct setup and adapted it to my pins (used SERCOM1 with PA16/PA17), and it worked.
The biggest hurdle was getting the MUX and pinmux settings right.
Definitely double-check against the SAM R34 datasheet and make sure the pins are not being used by LoRa or other peripherals.
I had similar frustration with those macros and just gave up on trying to use the pre-made defines. What I did was manually configure the SERCOM registers after checking the datasheet.
I used PA22/PA23 for SERCOM3 and set the MUX mode to D. My advice: forget about the macro names and just focus on configuring the right SERCOM, pads, and MUX based on the datasheet.
Also, make sure the PM and GCLK clocks for the SERCOM are enabled, easy to overlook and caused me hours of confusion. Once all that clicked, UART finally came alive.