Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
troyka
PostPosted: May 09, 2011 - 02:18 AM
Hangaround


Joined: Oct 28, 2009
Posts: 179


Right, thank you.. I hope not making the same mistake now, but still cannot find the interruption vectors...

The problem is I cannot find the part of the code dedicated to determine which interruption is generated,...
I have to add there, the filter to select the correct pin change interruption.

Another way to explain my question:
I understand that
HAL_RegisterIrq(IRQ_1, IRQ_LOW_LEVEL, bspKey1InterruptHandler);
is used something like "pass the new interrupt vector" through bspKey1InterruptHandler.
That's ok, but if I want to use the pin change interrupt, I have to check the PCIFx register to determine the correct pin change... I think this is not contemplated by the code right?
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 09, 2011 - 08:43 AM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

Well, there is no code to handle Pin Change interrupts in the HAL. So you need either add this code, or just define handlers in your application without modifying HAL, this will save you time when updating to the new version of BitCloud.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
troyka
PostPosted: May 09, 2011 - 04:01 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


All right, I'll do that, but I need a starting point to insert my code.
Where are located bitcloud's interruption vectors?
Regards
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 09, 2011 - 04:07 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

For already defined regular interrupts (not Pin Change interrupts) they are located in HAL/avr/atmega1284/common/src/halIrq.c.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
troyka
PostPosted: May 09, 2011 - 05:00 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


you mean the ISR(INT0_vect)function for example?
I couldn't find definitions of both, ISR and the vector.
Is that function defined in binary mode?
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 09, 2011 - 05:23 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

troyka wrote:
I couldn't find definitions of both, ISR and the vector.
I don't understand what do you need. ISR() is the handler for the interrupt vector.

troyka wrote:
Is that function defined in binary mode?
Nothing hardware depended is closed.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
troyka
PostPosted: May 09, 2011 - 05:37 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


Sorry that i'm not familiarized with ISR() handler, I'm mostly an assembler user and the procedure it's different.

I explain what I need:
On assembler, when the interruption is generated, the microcontroller jumps to a memory address, I'm trying to figure out what exactly happens on C and specifically how bitcloud handle that.

I assume that somehow when the interruption is generated, bitcloud can recognize different interruptions and automatically jump to ISR(INT0_vect) (if INT0 is fired)

I need to find that code who takes the decision to add the pin change code there too.

How much wrong I’m?
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 09, 2011 - 05:42 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

troyka wrote:
Sorry that i'm not familiarized with ISR() handler,
It is a part of the standard C library (avr-libc). It has nothing to to with the BitCloud. You need to find a tutorial on this site or just read avr-libc documentation.

ISR(INT0_vect) basically generates ISR handler code and puts jmp instruction into a vector table at the appropriate offset (INT0 in this case).

So you'll need to define something like ISR(PCINT0_vect).
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
troyka
PostPosted: May 10, 2011 - 02:54 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


That information was very helpfull, thanks.
After made the Pin Change interruption handlers, I was doing some tests:
When disabled the external interruptions using
Code:
EMPTY_INTERRUPT(INT0_vect);
EMPTY_INTERRUPT(INT1_vect);
EMPTY_INTERRUPT(INT2_vect);

The external interruptions was still working.
And the last strange thing was that if I modify the code on halirq.c with an error syntax, it's still compiling...
Syntax errors on the main C file are detected but on halirq.c I can write a letter to Santa and compile it... any idea why?
already run "make clean all"
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 10, 2011 - 03:17 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

troyka wrote:
any idea why?
After any change to the HAL you need to recompile it. Run "make clean all" in the HAL directory. Application just uses compiled library.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
troyka
PostPosted: May 10, 2011 - 03:41 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


Problem solved! thank you!
 
 View user's profile Send private message  
Reply with quote Back to top
troyka
PostPosted: May 13, 2011 - 04:56 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


Just the same way there are "commands" to light up symbols on the raven's LCD, and to send text to the alphanumeric section. Is there any pre-defined function to send numbers to the display's time section?
Regards!
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 13, 2011 - 06:28 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

troyka wrote:
Is there any pre-defined function to send numbers to the display's time section?
I have no idea, we use stock LCD driver firmware, so I suppose it should include those commands, but I don't know what they are. BSP for the Raven includes complete source code for the display firmware, you may look there.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
troyka
PostPosted: May 18, 2011 - 10:07 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


Hi, testing the following code on the board:
Code:

char post_screen[7]="   ";               
char num[10]="0123456789";
char   alfa[37]="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
appSendLcdMsg(post_screen);

The display start to show up all the numbers and letters, I think the reason was that "post_screen" was taken like a pointer and not like a string...right?
How can I do that casting?
I found some solutions on the web but no success…
Thankyou for your help!
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 19, 2011 - 06:54 AM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

troyka wrote:
I think the reason was that "post_screen" was taken like a pointer and not like a string...right?
I don't know what you did before, so I don't know what was wrong with it.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
troyka
PostPosted: May 19, 2011 - 02:21 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


This is the most simple code I can do and the error is similar, this time, the display start shifting from right to left the characters: "1234567@@@@@@@BBBBBB1234567 " and start again...
The @ I don't know if it's exactly @, maybe is an "e"

Code:
void APL_TaskHandler(void)
{
char   post_screen[7]="1234567";
char   post_screen2[7]="890ABCD";
appOpenLcd();
appSendLcdMsg(post_screen);
}
 
 View user's profile Send private message  
Reply with quote Back to top
troyka
PostPosted: May 19, 2011 - 02:28 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


Problem solved, the array was bad dimensioned....
Thaks!!
 
 View user's profile Send private message  
Reply with quote Back to top
troyka
PostPosted: May 19, 2011 - 07:45 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


Due to the last problem, I realise that all strings greater than 7 chars, the ATMEGA3290's functions automatically put the chars on a continuous rotating loop.
After that, all stream sended, (greater, equal or less than 7 chars) will participate on that continuous shifting...
Do you know any way to stop that shift?
regards.
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: May 19, 2011 - 08:52 PM
Raving lunatic


Joined: Apr 15, 2009
Posts: 4985
Location: San Jose, CA

troyka wrote:
Do you know any way to stop that shift?
No, you should look into the 3290's code. I've never seen it myself.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
troyka
PostPosted: May 28, 2011 - 07:12 PM
Hangaround


Joined: Oct 28, 2009
Posts: 179


Could you please tell me where is located/documented the 3290's code?
Sure is not on bitcloud bundle.
Do you refer to the AVR2017: RZRAVEN Firmware?
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits