quosego Posted March 22, 2011 Posted March 22, 2011 (edited) Hey all, Something else than those C++ and x86 asm programming stuff topics. Let's hope someone knows soemthing. I've been attempting to code an interrupt driven usart connection between an AVR chip board and the PC. (the PC is sending the data) However it seems that when an byte is recieved it keeps giving interrupts even when the buffer is read. (which should stop that according to the datasheet) Interrupt code which is properly triggered when recieving a byte but just keeps interrruptingand spamming my terminal: Serial_Recieve: ;store incoming bytes in r24,UDR out UDR, r24 reti Am I missing something here. Afaik I am initing the serial connection properly. regards, q. Edited March 22, 2011 by quosego
GaBoR Posted March 23, 2011 Posted March 23, 2011 You could try using "cli" instruction to disable interrupts before reading the buffer.
SchwiegerS Posted March 23, 2011 Posted March 23, 2011 You could try using "cli" instruction to disable interrupts before reading the buffer.As far as i know, you must disable the Interrupts, before you read... at the end of the interrupt, you can reenable it.
quosego Posted March 23, 2011 Author Posted March 23, 2011 Thnx for the replies, tried them both but no effect. I think some flag must be reset but I've reset about every flag there is.. Why can't they run everything on x86... That at least works.
ghandi Posted March 23, 2011 Posted March 23, 2011 This is a silly question, but there is not a 'control value' passed by which tells the AVR to stop triggering the interrupt? As, is there 0x00 - 0xFF available as valid 'data' byte values or is there a reserved byte like the null which terminates a C string?HR,Ghandi
GaBoR Posted March 24, 2011 Posted March 24, 2011 (edited) Do you know that:The Status Register is not automatically stored when entering an interrupt routine and restoredwhen returning from an interrupt. This must be handled by software.The SREG – AVR Status Register contains "Bit 7 – I: Global Interrupt Enable" . Edited March 24, 2011 by GaBoR
quosego Posted March 24, 2011 Author Posted March 24, 2011 Hey thanks all.. But I've found it, seems the cable was crap... And generated Stuff that wasn't there. Stupid cable programmed the thing fine but when doing simple connections it went bonkers. New cable and now all is fine.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now