0
\$\begingroup\$

I can't believe that this isn't working for me. It should be straightforward, but I've spent the afternoon on it & can't see where I'm going wrong. Hopefully someone will see my obvious mistake.

I'm picking up an existing project using an ATMEL SAM4LS8B processor. I'm developing with Eclipse MCU and debugging with Segger GDB server.

I have an input signal that I want to detect if it's high or low. My test jig has a switch, which I can use to toggle the input. I've probed the pin on the SAM4 Micro, and it definitely does go to 3.3V / 0V when I toggle the switch.

The pin is PortB pin 14 (pin 57). Using the Debugger I can read the Pin Value Register in the GPIO port memory map, and can see that the input status in the register is not changing (it stays at 0). One other input pin on the same port (PortB pin 9) which is being toggled by the test jig I can see changing in the PVR.

  • The pin that I'm failing to detect is configured as GPIO (GPER bit 14 = 1).
  • The pin that I can see toggling is configured as Peripheral D (Timer Counter input). (This pin has GPER bit 9 = 0)

The current GPIO Config register values I have are:

GPER      0x0000C4E0
PMR0      0x00003303
PMR1      0x00000300
PMR2      0x00000000
ODER      0x00000020
OVR       0x00000020
PVR       0x00003302 / 0x00003102 (toggling bit 9)

I've pored over the user manual, and I can't see that I'm doing anything wrong. I could assign the pin to an alternate function, and I guess it would work like bit 9 is working, but I'd rather make it work the way it should.

Thanks,

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.