ADC interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC interrupt

Jump to solution
901 Views
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 Kudos
1 Solution
447 Views
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

View solution in original post

0 Kudos
3 Replies
447 Views
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 Kudos
447 Views
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 Kudos
448 Views
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 Kudos