#avr Logs

Oct 24 2019

#avr Calendar

03:34 AM [1]MrMobius is now known as MrMobius
04:15 AM AinNero: i want to do one of the classics - generating a composite signal with an AVR chip
04:16 AM AinNero: whats the fastest way to bit-shift 5 bits into an GPIO pin?
04:16 AM LeoNerd: What do you mean "bitshift 5 bits in" ?
04:16 AM LeoNerd: You mean something a bit SPI-like but only 5 rather than 8 clocks?
04:17 AM AinNero: yeah
04:17 AM AinNero: i could use the SPI hw, but then i would have 8 bits plus the mandatory stop bit
04:17 AM AinNero: so my current idea is an unrolled loop
04:18 AM AinNero: rotating the current register one right through carry, then reading the flags into an register, and then writing that register to PORTB, for example
04:19 AM AinNero: would be 3 cycles per bit
04:20 AM LeoNerd: seems good
04:21 AM LeoNerd: Plus cycles to generate the clock
04:22 AM AinNero: composite does not need clock
04:22 AM AinNero: its the TV video scanline thing protocol
07:10 AM Fuchikoma: AinNero: Are you using any arbitrary pins or specific ones? And are you using the rest of the register for anything else?
07:11 AM AinNero: Fuchikoma: no, except for TXD for input
07:11 AM AinNero: so PORTB and PORTC are free to mess with
07:11 AM Fuchikoma: Hmm
07:11 AM AinNero: (atmega328p, TXD is PD0 or PD1)
07:12 AM Fuchikoma: My thought is if you can rotate the GPIO registeres through carry
07:12 AM Fuchikoma: Not sure if you can
07:14 AM Fuchikoma: If I was doing it in assembly (and I would be if I was doing it at all :D ) I'd set the carry flag, rotate once, and all subsequent bits would be shifts rather than rotates
07:14 AM Fuchikoma: That way you can tell you've sent all 8 bits once the register you're shifting is zero
07:14 AM Fuchikoma: Without having to count anything
07:14 AM AinNero: if im going to rotate it into the GPIO, i'd wire it to the MSB or LSB
07:14 AM AinNero: so i'd only need a single rotate and no additional shifts
07:15 AM Fuchikoma: Well, point being you need a way to send 8 bits no more and no fewer
07:16 AM AinNero: 5 bits
07:16 AM Fuchikoma: Okay 5 bits :)
07:16 AM Fuchikoma: Same logic applies
07:17 AM Emil: AinNero: consider joining #avrs
07:17 AM AinNero: whats there?
07:17 AM Fuchikoma: Emil is jsut shilling for his own channel (Read the topic)
07:17 AM AinNero: monty python taught me to be skeptical about splitters
07:20 AM Fuchikoma: heh
08:37 AM rue_bed: why do you want to shift out a gpio register?
08:38 AM rue_bed: do you just need to do synchronous serial?
08:55 AM AinNero: rue_bed: compositve video signal generation
08:55 AM AinNero: 5 bits per character
08:57 AM AinNero: .. per character per scanline
04:16 PM fengshaun: rue_mohr, write a bootloader for avr in C?
04:16 PM fengshaun: I'm not sure what a bootloader exactly does on a mcu
04:16 PM fengshaun: but if you have a link I could read up on that'd be awesome
04:17 PM polprog: bootloader as the name suggests boots up the mcu
04:18 PM polprog: not much to do on avr since it can only execute from flash
04:18 PM polprog: but bootloader code in avr can write to flash, so you can use a bootloader to sideload firmware
04:18 PM polprog: or load an update from a serial port/sd card whatever
04:19 PM polprog: arduino does that to sideload firmware over usb/serial
04:23 PM fengshaun: oh alright, that's somewhat useful
04:23 PM fengshaun: that'd be nice to know how to write
04:32 PM polprog: pretty much like any other code. you just need to flash it into the bootloader sector and set the fuses
04:33 PM polprog: its a small area
04:33 PM polprog: there are even c functions for flashmem access iirc
04:46 PM fengshaun: thanks!
11:39 PM day__ is now known as day