Posted March 22, 201114 yr 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, 201114 yr by quosego
March 23, 201114 yr You could try using "cli" instruction to disable interrupts before reading the buffer.
March 23, 201114 yr 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.
March 23, 201114 yr Author 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.
March 23, 201114 yr 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
March 24, 201114 yr 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, 201114 yr by GaBoR
March 24, 201114 yr Author 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.
Create an account or sign in to comment