|
Frequency counter, на LPC2214 |
|
|
|
Nov 18 2005, 14:37
|

Частый гость
 
Группа: Свой
Сообщений: 110
Регистрация: 30-11-04
Из: Nizhny Novgorod
Пользователь №: 1 262

|
Цитата Вообще надо подсчитать сколько тактов на все деяния уходит, тогда точно предельную частоту узнаем. Вот что по этому поводу в Technical Reference Manual пишут: Цитата 2.9 Interrupt latencies The calculations for maximum and minimum latency are described in: • Maximum interrupt latencies • Minimum interrupt latencies. 2.9.1 Maximum interrupt latencies When FIQs are enabled, the worst-case latency for FIQ comprises a combination of: Tsyncmax The longest time the request can take to pass through the synchronizer. Tsyncmax is four processor cycles. Tldm The time for the longest instruction to complete. The longest instruction is an LDM that loads all the registers including the PC. Tldm is 20 cycles in a zero wait state system. Texc The time for the Data Abort entry. Texc is three cycles. Tfiq The time for FIQ entry. Tfiq is two cycles. The total latency is therefore 29 processor cycles, just over 0.7 microseconds in a system that uses a continuous 40MHz processor clock. At the end of this time, the ARM7TDMI processor executes the instruction at 0x1c. The maximum IRQ latency calculation is similar, but must allow for the fact that FIQ, having higher priority, can delay entry into the IRQ handling routine for an arbitrary length of time. 2.9.2 Minimum interrupt latencies The minimum latency for FIQ or IRQ is the shortest time the request can take through the synchronizer, Tsyncmin, plus Tfiq, a total of five processor cycles.
|
|
|
|
|
Nov 18 2005, 15:16
|

Гуру
     
Группа: Свой
Сообщений: 13 372
Регистрация: 27-11-04
Из: Riga, Latvia
Пользователь №: 1 244

|
Цитата(Shedon @ Nov 17 2005, 12:52)  Есть желание зделать на capture LPC2214 подсчёт импульсов, вопрос до какой максимальной частоты я смогу считать импульсы и с какой точностью ? Fosc = 10MHz(с кварцевого генератора "СОНАТА" класса А), pll будет множить на 6, т.е. частота cclk=60MHz. Следует иметь ввиду, что ARM _собственный_ генератор лишь синхронизируемый ФАПЧ с опорным. Качество ФАПЧ никак не нормируется, как следствие, во что превратится действительно стабильный генератор - не понятно. Джитера уж точно будет много. Опорную частоту надо использовать непосредственно.
--------------------
Feci, quod potui, faciant meliora potentes
|
|
|
|
|
Nov 21 2005, 06:46
|

Частый гость
 
Группа: Свой
Сообщений: 166
Регистрация: 24-03-05
Из: Санкт-Петербург
Пользователь №: 3 661

|
Shedon:  Похоже мы вас в заблуждение ввели. В мануале четко написано, что вход Capture можно использовать как счетный, если выставить нужные биты в TxCTCR. Count Control Register (CTCR: TIMER0 - T0CTCR: 0xE0004070; TIMER1 - T1TCR: 0xE0008070) The Count Control Register (CTCR) is used to select between Timer and Counter mode, and in Counter mode to select the pin and edge(s) for counting. When Counter Mode is chosen as a mode of operation, the CAP input (selected by the CTCR bits 3:2) is sampled on every rising edge of the pclk clock. After comparing two consecutive samples of this CAP input, one of the following four events is recognized: rising edge, falling edge, either of edges or no changes in the level of the selected CAP input. Only if the identified event corresponds to the one selected by bits 1:0 in the CTCR register, the Timer Counter register will be incremented. Effective processing of the externaly supplied clock to the counter has some limitations. Since two successive rising edges of the pclk clock are used to identify only one edge on the CAP selected input, the frequency of the CAP input can not exceed one half of the pclk clock. Consequently, duration of the high/low levels on the same CAP input in this case can not be shorter than 1/fpclk. Это значит что максимальная частота счета на практике будет чуть меньше PCLK/2, в вашем случае - примерно 28 МГц, и вы можете сделать нормальный частотомер. Так что заботиться о прерываниях не стоит.
|
|
|
|
|
Nov 21 2005, 08:28
|

Профессионал
    
Группа: Модераторы
Сообщений: 1 951
Регистрация: 27-08-04
Из: Санкт-Петербург
Пользователь №: 555

|
Цитата(moonrock @ Nov 21 2005, 09:46)  Shedon:  Похоже мы вас в заблуждение ввели. В мануале четко написано, что вход Capture можно использовать как счетный, если выставить нужные биты в TxCTCR. Count Control Register (CTCR: TIMER0 - T0CTCR: 0xE0004070; TIMER1 - T1TCR: 0xE0008070) The Count Control Register (CTCR) is used to select between Timer and Counter mode, and in Counter mode to select the pin and edge(s) for counting. When Counter Mode is chosen as a mode of operation, the CAP input (selected by the CTCR bits 3:2) is sampled on every rising edge of the pclk clock. After comparing two consecutive samples of this CAP input, one of the following four events is recognized: rising edge, falling edge, either of edges or no changes in the level of the selected CAP input. Only if the identified event corresponds to the one selected by bits 1:0 in the CTCR register, the Timer Counter register will be incremented. Effective processing of the externaly supplied clock to the counter has some limitations. Since two successive rising edges of the pclk clock are used to identify only one edge on the CAP selected input, the frequency of the CAP input can not exceed one half of the pclk clock. Consequently, duration of the high/low levels on the same CAP input in this case can not be shorter than 1/fpclk. Это значит что максимальная частота счета на практике будет чуть меньше PCLK/2, в вашем случае - примерно 28 МГц, и вы можете сделать нормальный частотомер. Так что заботиться о прерываниях не стоит. А где вы нашли эту информацию? регистра CTCR у 2214 я не нашел
|
|
|
|
|
May 31 2007, 07:44
|
Участник

Группа: Участник
Сообщений: 23
Регистрация: 14-08-06
Пользователь №: 19 528

|
Цитата(zltigo @ Nov 18 2005, 19:16)  Качество ФАПЧ никак не нормируется, как следствие, во что превратится действительно стабильный генератор - не понятно. Джитера уж точно будет много. Опорную частоту надо использовать непосредственно. Ну эт вы загнули! Если бы речь шла о тактировании АЦП - там да, джиттер играет. Но для счета импульсов... Думаю, при счете любого кол-ва импульсов больше 1, точность всегда будет +- 1 период тактовой, главное, чтоб частота этой тактовой не плавала. В цепях с ФАПЧ обычно стоит как вкопаная. А по поводу внутреннего АЦП, который тактируется от pclk, так там делитель не малый стоит. Он джиттер оч сильно уменьшает. Так что здесь все гладко. Немного пугает еррата, где написано про потерю прерываний от таймера... Моежт, в очередной ревизии пофиксят, а пока все делаем "ручками".
|
|
|
|
|
Jun 4 2007, 07:06
|
Местный
  
Группа: Свой
Сообщений: 200
Регистрация: 10-04-06
Из: Украина,Запорожье
Пользователь №: 15 979

|
Цитата(Make_Pic @ Jun 1 2007, 12:23)  Ставлю к LPC22XX дополнительно FPGA для счетчиков, квадр. енкодеров, и другой цифровой лабуды для общения с внешним миром. Ага.Или PIC16 какйнить мелкий, в зависимости от конкретного экземпляра 65-85МГц можно мерить.Ну и прицепить его скажем на I2C или SPI. Еще как вариант перейти на использование SAM7 у них счетный вход имеется.
|
|
|
|
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0
|
|
|