#avr Logs

Aug 18 2019

#avr Calendar

06:38 AM Thrashbarg_ is now known as Thrashbarg
11:45 AM rue_mohr: id's?
12:41 PM Smidge204: I have a list of audio files, each numbered so that can be played according to their number
12:44 PM Smidge204: So the data comes back, as an example, 0x05 0x34 which would be 5:34 AM. So this code generates a string of file IDs to it will play back "Five Thirty Four AM" as a series of four different audio clips
02:56 PM Smidge204: So I trace the program in Atmel Studio and it seems to work fine, sending "AA 04 00 AE AA 13 01 1E DC" to the UART register.
02:56 PM Smidge204: In circuit, however, the data is "AA 04 00 AE 04 03 02 01 11"
02:56 PM Smidge204: (ere... that last byte should be 00 not 11)
02:57 PM Smidge204: What could be causing such a strange behavior?
02:59 PM cehteh: no idea what atmel studios trace does, but i bet for a race
02:59 PM Smidge204: Not sure what's racing. At this point I send that data and enter a delay loop that just does nothing
02:59 PM Smidge204: hrm
03:00 PM cehteh: delay loop smells like races :D
03:00 PM cehteh: you use isr for sending or polling w/o isr?
03:01 PM Smidge204: NO interrupts
03:02 PM Smidge204: The serial stream is out only, and under normal circumstances I'd be monitoring a separate "busy" line to know when the slave device is ready for another command
03:03 PM cehteh: kindof homegrown flow control?
03:04 PM Smidge204: Just the easiest way to do it. Othrewise I'd have to be constantly asking the device if it's busy with a command and reading the response
03:05 PM LeoNerd: Slight bit of baud rate upset?
03:05 PM Smidge204: not impossible the timing got messed up... lemme double check
03:06 PM cehteh: you have pauses between sending messages?
03:11 PM Smidge204: Timing is ~9700 according to the scope, 1% off from 9600 baud
03:13 PM cehteh: can you improve that? 1% is ok but maybe you can get better, but i guess thats unrelated, i am still at the race condition
03:14 PM Smidge204: I can try to tune that out but is it really te source of the problem?
03:14 PM cehteh: i doubt it
03:15 PM cehteh: more likely racy or off by one .. trying to send data thats not ready
03:15 PM cehteh: or trying to send when the usart isnt ready
03:19 PM Smidge204: Tuned to 9650-ish
03:19 PM Smidge204: So that's guaranteed not an issue even if it wasn't before
03:23 PM Smidge204: Found the problem :D
03:34 PM Smidge204: it verks~
03:35 PM Smidge204: So the problem was I mixed up the registers and was sending the string pointer instead of the string character, hence the countdown. Classic blunder.
05:41 PM djph: Smidge204: started a landwar in asia?
05:48 PM cehteh: Smidge204: i thought it worked under the debugger/trace .. that makes me wonder
05:50 PM Smidge204: Well it "worked" in the IDE but only because I was looking at what register the data went into *before* the function call. The function was looking for the data in a different register, which I happened to be using as a counter
05:52 PM cehteh: hah
11:56 PM day__ is now known as day