I/O toggle frequency

Discussion around product based on ARM Cortex M3 core.

Moderators: nferre, ncollot

fichmant
Posts: 3
Joined: Thu Sep 18, 2014 11:47 am

I/O toggle frequency

Fri Sep 26, 2014 3:17 pm

I am trying to configure sam3x8e to run at 84Mhz I built a small program that toggle one of the pins, however the max frequency I get from it is 4Mhz
any advice?
#include "system_sam3xa.h"
#include "sam3x8c.h"

int main(void)
{
SystemInit();
PIOB->PIO_PER |= PIO_PB27;
PIOB->PIO_OER |= PIO_PB27;
PIOB->PIO_OWER |= PIO_PB27;

while (1)
{
PIOB->PIO_ODSR &= ~PIO_PB27;
PIOB->PIO_ODSR |= PIO_PB27;

}
}

Image
nutsnbolts
Posts: 31
Joined: Mon Aug 25, 2014 11:20 pm

Re: I/O toggle frequency

Sat Sep 27, 2014 11:47 pm

See my post about the bus matrix:
discussions/viewtopic.php/f,24/t,22732.html
The figures quoted there are for a SAM3U at 96MHz.
Is anything running in the background? (interrupts etc.) Is the peripheral clock configured at MCLK?
For a simple toggle, the CODR and SODR as shown should be quicker than a logic operation in terms of machine cycles (check the assembly- put a breakpoint in your loop & view the debug output- it'll also show you just where those precious machine cycles are going!) As an aside, your frequency readout shows 4.7MHz -near as dammit- that's nearer 5MHz than 4! :wink:
Hope this helps,
Mike.
fichmant
Posts: 3
Joined: Thu Sep 18, 2014 11:47 am

Re: I/O toggle frequency

Thu Oct 02, 2014 10:46 am

Thank you for your reply.
After playing a little bit with the TC, PWM and UART I have no doubt that the controller is running at 84 Mhz.
I guess it can't toggle its peripheral I/O at that frequency for some reason, but it's okay I need its speed for calculation and not for toggling an LED :))

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 2 guests