ADC interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

ADC interrupt

跳至解决方案
1,587 次查看
matute
Contributor III

Hi,

 

I need to detect when a convertion of ADC channel is below of ADLLMT register (to detect power off), so to that situation I need an interrupt isr to serve it. I could install them touching ADC register after install ADC driver on MQX to put low limit on ADLLMT and install the isr on interrupt vector table (low limit is 115 on MCF52259). The problem seems to be that interrupt isn't fast as I need to identify when power off occurs.

 

Then, to solve that problem, I tried configurating all ADC register manually (changing ADC registers as if I weren't using MQX). Convertions were working but when y change ADLLMT to verify if isr code is called result that it isn't.

 

Due to measurement that I did, I need less than 15ms to detect when power off occurs and save some information on SD card.

 

So, There are any possibility to solve this inconvenient? 

0 项奖励
回复
1 解答
1,133 次查看
matute
Contributor III

I've found that the ADC isr works perfectly because I could measure the time that ist takes to catch mqx time and exits. The problem was on time write of SD card. So, I've changed the strategy to register a power off event. As well as that isr works fine, then I catch mqx time and put it on a structure in RAM. As I have a battery connected to Vsby pin, RAM doesn't delete when power off event occurs. Then I read the Reset Register and I detect if the last reset was due a power off event. By this way I can save the event reading the structe on RAM with mqx time saved before power off.

 

Thanks for yours replies.

 

Regards

Matt

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,133 次查看
c0170
Senior Contributor III

Hi matute,

 

have you tested your code with  _int_install_kernel_isr ? That should provide you faster response although it consumes more RAM because vectors are copied into the RAM.

 

Check User guide section 3.9.3.3 Non-Maskable Interrupts and reference manual 2.1.45 _int_install_kernel_isr.

 

Regards,

MartinK

 

 

0 项奖励
回复
1,133 次查看
matute
Contributor III

Hi Kojto.

 

Yes, I thought that solution. But I need to catch mqx time to register the power off event and I read that in kernel_isr cannot use mqx functions.

 

Regards

Matt

0 项奖励
回复
1,134 次查看
matute
Contributor III

I've found that the ADC isr works perfectly because I could measure the time that ist takes to catch mqx time and exits. The problem was on time write of SD card. So, I've changed the strategy to register a power off event. As well as that isr works fine, then I catch mqx time and put it on a structure in RAM. As I have a battery connected to Vsby pin, RAM doesn't delete when power off event occurs. Then I read the Reset Register and I detect if the last reset was due a power off event. By this way I can save the event reading the structe on RAM with mqx time saved before power off.

 

Thanks for yours replies.

 

Regards

Matt

0 项奖励
回复