#avr Logs

Oct 29 2019

#avr Calendar

12:22 AM day__ is now known as day
01:42 AM Miyu is now known as hackkitten
03:33 PM egy: hello #avr! well, i should've tried the stimuli file thing atmel studio provided then reporting the results here, but anyway
03:33 PM egy: why isn't UBRRH set ? https://transfer.sh/dxWuM/1.png https://transfer.sh/dxWuM/2.png
03:36 PM egy: i've been stuck on ^ for like, one week now. the code simply sets UBRRH with 1<<URSEL (i.e 128). this is atmega16 and it's stated clearly in the datasheet (page 167) that you need to set this bit in order to use UCSRC register
03:38 PM egy: the value in my custom struct is uint8_t, with value 128
04:06 PM twnqx: let me quickly check something to see if my memory is right
04:09 PM twnqx: right
04:09 PM twnqx: your code writes 0 to ubbrh
04:10 PM twnqx: err ucsrc
04:10 PM twnqx: how do you verify that you had no success, egy?
04:15 PM twnqx: mind the bottom of page 167 - URSEL (bit 7 of UBRRH) always reads 0, while writing it only selects which of the two registers are written to
04:17 PM twnqx: and it will only read 1 if you actually read UCSRC, which requires you to read the same register twice, as in bottom of page 162/top of page 163
04:18 PM twnqx: and if you read in C, you probably want to check the assembler code that was generated if you have to in instructions in sequence - the C compiler might do a different order, like read reg, store to variable, read reg, store to variable - which will never read UCSRC but only UBRRH all the time
04:19 PM twnqx: *two "in" instructions in sequence
04:23 PM polprog: i think gcc and / or is made to write to the right register in a simple way
04:23 PM polprog: and theres always inline asm when that fails
04:36 PM twnqx: still if somethig is not working it's better to check instead
04:44 PM egy: twnqx: by actually stepping in the debugger; that's why i included the i/o debugger view in the screenshot
04:44 PM twnqx: then you lose
04:44 PM egy: and i write non-zero value to ucsrc as well https://transfer.sh/kt4rb/3.png and https://transfer.sh/kt4rb/4.png
04:45 PM egy: huh ? why do i lose ? let me re-read your words again
04:45 PM twnqx: you can't step through reading UCSRC
04:45 PM twnqx: because the two reads need to be in consecutive cycles
04:45 PM twnqx: cpu cycles
04:45 PM twnqx: no delay introduced through a debugger
04:53 PM egy: okay, let me get this again; i don't read UCSRC, at all; by "reading" do you mean viewing the debugger ui ?
05:29 PM egy: i made a little experiment: i've set ubrrh to 3, this immeaditely set ucsrc (they're the same i/o afterall) but doing the opposite fails
05:30 PM egy: FYI, i'm running inside atmel's simulator; i'm not actually using any board. also, my method of inspection is with, again, the i/o panel in debug mode
08:49 PM rue_mohr: well, do not use a simulator
08:49 PM rue_mohr: things dont work the same in the real world
08:50 PM rue_mohr: unless, you ONLY want the code to work on a simulator
08:50 PM rue_mohr: your trying to set up serial, on which avr?