problems outputting a clock to a pin - ATSAMS70Q21B

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to output a 2Mhz clock to pin PE0 which has a peripheral B function of TIOA9  which is Timer-Counter 3 (TC3) Channel 0.  I am trying to use START to configure this but I am not getting an output, the pin just stays high.

 

In START I selected the Timer_0 driver which I added to the project to edit the parameters.  I selected the HAL:Driver:Timer from Driver and TC3 for the Instance and selected PE0 (TIOA/9) checkbox to assign this pin to this channel.  For the Timer configuration on TC3 below that I selected MCK/8 and put in 100us for the tic time.  All other boxes left unchecked (Event output enable, external events/trigger, fault output control).  Then Gen Proj, and compiled. 

 

If I check the pin mux configurator I see that pin is assigned to the timer_0 peripheral so that's good.

 

in the driver_init.c code I see the following code was inserted:

 

* Enables Timer peripheral, clocks and initializes Timer driver
 */
static void TIMER_0_init(void)
{
    _pmc_enable_periph_clock(ID_TC3_CHANNEL0);
    timer_init(&TIMER_0, TC3, _tc_get_timer());
}

 

Is there anything additional I need to do to get this signal to the pin?  Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have no experience with SAM parts, so just a guess, did you make the pin an output?

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
stack gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

I have no experience with SAM parts, so just a guess, did you make the pin an output?

 

Jim

 

 

I just gave that a try by adding this code:

 

gpio_set_pin_level(MYPIN,false);
// Set pin direction to output
gpio_set_pin_direction(MYPIN, GPIO_DIRECTION_OUT);

 

but it didn't do anything and even though I specified the level to be false, the output comes up in a high state as well, so it seems the peripheral is controlling the output (which it should be) instead of the gpio itself.

Since it appears to be connected to the peripheral, it seems possibly the TC is either not counting or the TC output is not changing state (staying high)

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Like the others, I have no experience with SAM devices. But, given your symptoms, I wonder if you are clocking the counter?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net