Page 8 of 15

Posted: 10 Apr 2015, 03:32
by XMIT
phosphorglow wrote: "Converting to 3.3 volts saves a lot of power. But the CPU is not rated to run at 16 MHz when powered by 3.3 volts. It usually works, at least at room temperature, but technically 16 MHz at 3.3 volts is overclocking." (From PJRC).

...wonder what would happen if I stuck it in the refrigerator and tried flashing it... ;P
The fridge would have nothing to do with it. Strictly speaking 16MHz at 3.3V isn't overclocking, it's undervoltaging. The two are different on a fundamental level. At a lower voltage some circuits won't be able to run as quickly due to RC time constants, parasitics, FET characteristics, and all sorts of other things. It might work, sometimes. Putting the setup in the fridge would't help with cooling (not like putting a water cooler on an overclocked CPU) but it might drop the resistances on some temperature dependent parts of the circuit.

I would follow Atmel's direction as mentioned in their data sheet. I don't have the data sheet handy but do they provide a reference clock circuit for 3.3V operation?

Posted: 10 Apr 2015, 03:46
by phosphorglow
Ahhhhh yeah, that does make quite a bit of sense. Heh!

Correct, sir. Turns out there is a nice little chart in the datasheet (databook, that thing is huge).
controller15.jpeg
controller15.jpeg (45.83 KiB) Viewed 5398 times
Another instance where I can yell at myself for not RTFM. 8MHz crystal, here we go!

Posted: 10 Apr 2015, 04:22
by hasu
The MCU is shipped with FUSE bit CKDIV8 is programmed, this means clock is prescaled by 8 when powering up. So system clock is end up 2MHz with using external 16MHz crystal and it is totally within spec. As far as I know bootloader should work with 16MHz crystal and 3.3V.

After powering up we usually set devider of prescaler to 1 in firmware to get full frequency 16MHz for system clock. Then this is out of spec if VCC is 3.3V. Probably it will still work at 16MHz but we might want to use 8MHz system clock for safty and power saving.


I'm still suspecting USB power line. In your current setup UVcc/VBus line has no capacitor again, right?
Then, what if adding cap at UVcc/VBus line?

Posted: 10 Apr 2015, 04:31
by phosphorglow
Ah! So my fuzzy understanding of the CKDIV8 fuse was actually pretty good, then. Yay! I think I'm starting to finally grasp the concepts here. :P

Cap on UVcc/VBus - great idea, I'll give it a try!

Posted: 10 Apr 2015, 04:36
by phosphorglow
Nope... same story. :/

Posted: 11 Apr 2015, 02:28
by hasu
I tested with Atmel USBKEY board which has AT90USB1287 powered with 3.3V and 8MHz. I replaced the crystal with 16MHz and it doesn't work! against my expectation. Hmm, It looks like AT90USB128's bootloader doesn't work with 16MHz when it is powered with 3.3V unfortunately.

Meanwhile, ATMega32U4's bootloader works with 16MHz even under 3.3V power.

Posted: 11 Apr 2015, 02:36
by phosphorglow
Awesome awesome awesome! Thanks for trying that out. Much appreciated. :)

Posted: 17 Apr 2015, 00:56
by phosphorglow
Well, extra components including 8MHz crystals arrive tomorrow. In the mean time I've changed the configs that Halvar sent me to reflect the correct pins on the controller.

Realized that F7, F5, and F4 are JTAG pins. Not an issue since they're spare, but annoying since I had them close to the EZKey for a reason. No matter.

Also realized I didn't switch the TX/RX pins around physically, so jumpers are needed. Annoying. I think I may have killed my EZKey since the only keycode it sends is for RALT. hid_listen shows it's sending proper HID codes via serial, so something is wonky.

Posted: 17 Apr 2015, 01:21
by Muirium
USB functionality is present and correct, right? (aka: your originally intended design!) Because gimme gimme gimme!

Posted: 17 Apr 2015, 01:25
by phosphorglow
Oh yeah, that's working just ducky. BT is being the finicky little thorn. :P

Posted: 17 Apr 2015, 21:26
by vsev
Muirium wrote: USB functionality is present and correct, right? (aka: your originally intended design!) Because gimme gimme gimme!
+1, +2, +3 ?
Indeed I'm thinking strongly about getting couple of your controller when it'll be available, great job !

Posted: 17 Apr 2015, 21:36
by Madhias
Muirium wrote: USB functionality is present and correct, right? (aka: your originally intended design!) Because gimme gimme gimme!
Seconded! I really have a wacky solution for now... It needs to be replaced!

Image

:oops:

Posted: 17 Apr 2015, 22:59
by phosphorglow
Actually... that's a clever little setup, nice! :D

Posted: 17 Apr 2015, 23:02
by phosphorglow
Alright. Annoyances continue.

8MHz crystal at 3.3V = erase and flash perfectly and passes verify. Yay!

On the other hand, firmware isn't working. I changed the F_CPU = 8000000 in the makefile. Am I missing something?

Posted: 19 Apr 2015, 22:45
by phosphorglow
Well, I'm typing over bluetooth right now.

...using a 16MHz crystal at 5V. I did set the F_CPU = 8000000 in the makefile though, and F_USB = 16000000.

Soooooo... Advice from where to go from here? Perhaps a 3.6V regulator instead?

(Bluetooth, though! That's neato. Wish I would have caught the TX/RX trace reversal. Oh well. :P)

Posted: 19 Apr 2015, 23:32
by phosphorglow
(Also, jump to bootloader only resets the controller. I was under the impression it was similar to hitting the reset switch and getting into DFU mode?)

Posted: 21 Apr 2015, 21:37
by phosphorglow
Well, finding a voltage regulator above 3.3V with a good dropout voltage is a bit difficult apparently.

So, with a 16MHz crystal and the firmware flashed at 5V, I can run it at 3.3V. Just can't reflash it at 3.3V.

8MHz crystal flashes at 3.3V, but firmware doesn't run. I'm confuzzled.

Posted: 22 Apr 2015, 00:39
by regack
phosphorglow wrote: Well, finding a voltage regulator above 3.3V with a good dropout voltage is a bit difficult apparently.

So, with a 16MHz crystal and the firmware flashed at 5V, I can run it at 3.3V. Just can't reflash it at 3.3V.

8MHz crystal flashes at 3.3V, but firmware doesn't run. I'm confuzzled.
But everything works normally at 5v/16MHz? Sorry, I have nothing else to add :(

Posted: 22 Apr 2015, 01:30
by hasu
phosphorglow wrote: Alright. Annoyances continue.

8MHz crystal at 3.3V = erase and flash perfectly and passes verify. Yay!

On the other hand, firmware isn't working. I changed the F_CPU = 8000000 in the makefile. Am I missing something?
hmm, how did you do with prescaler and UART setting? I guess UART buad rate is messed for some reason.

Posted: 22 Apr 2015, 04:12
by phosphorglow
hasu wrote: hmm, how did you do with prescaler and UART setting? I guess UART buad rate is messed for some reason.
8MHz Crystal installed.

In the bluefruit main.c: CPU_PRESCALE(CPU_8MHz)

After you mentioned the prescaling I changed the pjrc main.c with no effect: CPU_PRESCALE(0x01);

In config.h:

Code: Select all

/* USART configuration
 *     asynchronous, 9600baud, 8-data bit, non parity, 1-stop bit, no flow control
 */
#define SERIAL_UART_BAUD       9600
#define SERIAL_UART_DATA       UDR1
#define SERIAL_UART_UBRR       ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
#define SERIAL_UART_RXD_VECT   USART1_RX_vect
#define SERIAL_UART_TXD_READY  (UCSR1A&(1<<UDRE1))
#define SERIAL_UART_INIT()     do { \
    UBRR1L = (uint8_t) SERIAL_UART_UBRR;       /* baud rate */ \
    UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8);  /* baud rate */ \
    UCSR1B = (1<<TXEN1);                /* TX: enable */ \
    UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
             (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
    sei(); \
} while(0)
And the makefile has F_CPU = 8000000 and F_USB = 8000000 (tried it at 16 as well).

Posted: 22 Apr 2015, 04:58
by hasu
Actually what code repositry are you using from?
In the bluefruit main.c: CPU_PRESCALE(CPU_8MHz)
I don't know what value 'CPU_8MHz' means in fact, I think TMK doesn't define that macro.
Note that it should be 0 to set DIV1 because your board has 8MHz xtal and you want to give system 8MHz.


If you are using these values they are not useful for your board with 8MHz xtal. They are only for 16MHz xtal(Teensy's default clock).
https://www.pjrc.com/teensy/prescaler.html

Posted: 22 Apr 2015, 05:41
by phosphorglow
It's a pull from your github from January maybe? Halvar sent it to me based on what he was working on.

In the main.c there was a: #define CPU_8MHz 0x01

Anyways, I tried 0x00 in both main.c files and I'm still not getting anything.

Posted: 22 Apr 2015, 05:45
by hasu
Ah, OK. Maybe Halvar can sort out the problem.

Posted: 22 Apr 2015, 08:18
by Halvar
Yes, the constant CPU_8MHz is defined in the same file, and it's for use with a Teensy 2.0++, I stole these definitions from the same PJRC page hasu linked to above. So I agree it should be 0x00 for you.

Posted: 28 Apr 2015, 01:04
by Muirium
My controller arrived a few minutes ago, and it's straight in the SSK and working like a champ! Phosphor's done a superb job with these. I ordered the deluxe version with Bluetooth and battery goodies, still to be installed. But USB works right out of the box. The easiest USB conversion I've ever made! Only tool required: 5.5 mm nutdriver for opening the SSK. Genius!

Posted: 28 Apr 2015, 01:27
by regack
Muirium wrote: My controller arrived a few minutes ago, and it's straight in the SSK and working like a champ! Phosphor's done a superb job with these. I ordered the deluxe version with Bluetooth and battery goodies, still to be installed. But USB works right out of the box. The easiest USB conversion I've ever made! Only tool required: 5.5 mm nutdriver for opening the SSK. Genius!
Did I miss some kind of buy for these, or are you doing some beta testing? Otherwise, please point me in the direction of purchasing :D

Posted: 28 Apr 2015, 02:03
by phosphorglow
regack wrote: Did I miss some kind of buy for these, or are you doing some beta testing? Otherwise, please point me in the direction of purchasing :D
Well, they're unofficially officially available. :P

Basically the big announcement at the moment is if you want a USB-only controller, PM me and when it comes time to order more components I'll get back with you. I'm juggling quite a few projects at the moment so once all that jazz settles down I'll get back to more of these.

As for bluetooth, if you don't mind soldering a bunch of jumper wires and fiddling around a bit you can pick up the modules from Adafruit. I'm still playing around with the fiddly details, but the plan is to run it at 5V on USB and 3.3V on battery. Requires a creative placement of the voltage regulator... ;P

Posted: 28 Apr 2015, 02:52
by Muirium
Yup. I'm an early tester, but USB-wise this thing is 100% complete! Bluetooth will be "interesting", as we say! Hopefully in a good way.

The extended functionality (breadboard area) of this controller is entirely optional anyway. The built-in USB B port is working magnificently!

Posted: 28 Apr 2015, 03:12
by rsbseb
Any update on the USB controller for the 122 matrix?

Posted: 28 Apr 2015, 03:46
by phosphorglow
122 is basically just waiting on me to map out the matrix for the firmware config, which I expect to do this week.