x0x running super slow

Discuss x0x construction and related issues

Moderators: altitude, adafruit_support_bill, adafruit, phono, hamburgers

Please be positive and constructive with your questions and comments.
Locked
oleoleole
 
Posts: 3
Joined: Tue Jan 07, 2014 4:04 pm

x0x running super slow

Post by oleoleole »

Hi all. First post :)

Just put together a sweet silver box from xoxshop..
All sounds well and works like a charm except midi in-out and that it has a max tempo of around 64 bpm.
I can adjust it downwards, to ridiculously slow speeds but not faster.
Can it be the clock source for the processor thats wrong somehow?

Thanks y'all

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: x0x running super slow

Post by antto »

weird
the firmware has no way to know about time, it assumes it knows the cpu clock speed
the cpu itself probably doesn't care either, so it should be down to the "fuse" settings and the actual XTAL
but really?

can you borrow another cpu from somewhere (one which surely works) and pop it in your x0x?
and check the XTAL just in case, it should be 16MHz

oleoleole
 
Posts: 3
Joined: Tue Jan 07, 2014 4:04 pm

Re: x0x running super slow

Post by oleoleole »

antto wrote:weird
the firmware has no way to know about time, it assumes it knows the cpu clock speed
the cpu itself probably doesn't care either, so it should be down to the "fuse" settings and the actual XTAL
but really?

can you borrow another cpu from somewhere (one which surely works) and pop it in your x0x?
and check the XTAL just in case, it should be 16MHz
Yes that is what I thought. Also the buttons and knobs have a certain latency, is this normal behavior?
I think I'll try changing the xtal first.
Have still got no luck connecting with BANNED..

Well luckily I'm berlin based so i'm in contact with xoxshop.de :) Also know a good electronics store. Gotta go get parts for next project soon anyway....

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: x0x running super slow

Post by antto »

in the stock firmware (and most of the others which are derived from it) the buttons do have latency
the debouncing code is pretty strong, according to my calculations iirc it was around 20 to 40ms latency
so if the whole cpu is running at a very slow clock - this latency becomes even slower

the cpu is not directly connected to the USB, but instead, there is a dedicated chip (FTDI) which deals with the USB
the cpu is supposed to run at a fixed rate when communicating with the FTDI chip, so if the cpu is running much slower - the FTDI chip will just not do what it should, tho, it will most likely connect to the computer successifully since it has its dedicated XTAL
...just no valid data will come out of the cpu to the chip

oleoleole
 
Posts: 3
Joined: Tue Jan 07, 2014 4:04 pm

Re: x0x running super slow

Post by oleoleole »

antto wrote:in the stock firmware (and most of the others which are derived from it) the buttons do have latency
the debouncing code is pretty strong, according to my calculations iirc it was around 20 to 40ms latency
so if the whole cpu is running at a very slow clock - this latency becomes even slower

the cpu is not directly connected to the USB, but instead, there is a dedicated chip (FTDI) which deals with the USB
the cpu is supposed to run at a fixed rate when communicating with the FTDI chip, so if the cpu is running much slower - the FTDI chip will just not do what it should, tho, it will most likely connect to the computer successifully since it has its dedicated XTAL
...just no valid data will come out of the cpu to the chip

Ok. Sounds more logical then. Gonna talk to xoxshop about getting a new xtal.
Thanks for the help!

sunflower
 
Posts: 5
Joined: Wed Aug 29, 2012 2:41 pm

Re: x0x running super slow

Post by sunflower »

oleoleole wrote:
antto wrote:in the stock firmware (and most of the others which are derived from it) the buttons do have latency
the debouncing code is pretty strong, according to my calculations iirc it was around 20 to 40ms latency
so if the whole cpu is running at a very slow clock - this latency becomes even slower

the cpu is not directly connected to the USB, but instead, there is a dedicated chip (FTDI) which deals with the USB
the cpu is supposed to run at a fixed rate when communicating with the FTDI chip, so if the cpu is running much slower - the FTDI chip will just not do what it should, tho, it will most likely connect to the computer successifully since it has its dedicated XTAL
...just no valid data will come out of the cpu to the chip

Ok. Sounds more logical then. Gonna talk to xoxshop about getting a new xtal.
Thanks for the help!
Did you manage to solve this? I just finished building my x0xb0x yesterday (also from x0xsh0p.de) and had the same issue including it don't seem to recv/send midi (tried setting tempo using a drummachine - also tried other way around)

Tried debugging it yesterday and after lots of checking of all the solder points I decided to do some testing using my older x0xb0x I build some years ago.

First I tested the power/io-board by using it in my old working x0xb0x. No problems with communication and power.
After that I had the idea of swapping the CPUs between the two x0xb0x. Suddenly my new built x0xb0x started working while my old x0xb0x acted the same way as the the new one did before the swap..
So my best bet is that there's something weird with the firmware on the new CPU.. unfortunately I can't seem to flash it using BANNED, I get DeviceID string errors every time.. starting to wonder if there's no bootloader.

Pretty annoying to have spend a couple of days building and now it's not working ;)

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: x0x running super slow

Post by antto »

so, you swapped the atmega162's and the non-working x0x works with the chip from the working x0x?
that would rule out the XTAL, since the XTAL is on the mainboard

it might be the chip's fuse settings being wrong in terms of the clock...

sunflower
 
Posts: 5
Joined: Wed Aug 29, 2012 2:41 pm

Re: x0x running super slow

Post by sunflower »

antto wrote:so, you swapped the atmega162's and the non-working x0x works with the chip from the working x0x?
that would rule out the XTAL, since the XTAL is on the mainboard

it might be the chip's fuse settings being wrong in terms of the clock...
Yes I think so too.. going to do some more tests tonight to be completely sure.
But lets say it is the fuses/bootloader that is the issue.. would I need to re-flash the ship? I don't have a AVR programmer but from what I understand I could use a Arduino as a ISP programmer to flash the Atmega162? Anyone have any experience with this?

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: x0x running super slow

Post by antto »

the bootloader is like the firmware, it's not aware if the conditions are right or wrong
the fuse settings are above all that

a programmer will be required to deal with the fuses
if that arduino can do ISP - it should work

sunflower
 
Posts: 5
Joined: Wed Aug 29, 2012 2:41 pm

Re: x0x running super slow

Post by sunflower »

antto wrote:the bootloader is like the firmware, it's not aware if the conditions are right or wrong
the fuse settings are above all that

a programmer will be required to deal with the fuses
if that arduino can do ISP - it should work
cool, will look in to it tonight. Thanks

sunflower
 
Posts: 5
Joined: Wed Aug 29, 2012 2:41 pm

Re: x0x running super slow

Post by sunflower »

Success! After some struggling with getting the Arudino to act as a ISP for the atmega162 I finally succeeded yesterday to set the fuses and re-flash it. Now the new x0xb0x is working as it's supposed to do :D

I'm currently at work but I can post more detailed on how I fixed it tonight.

But I more or less used these pages to help me get started:
http://forum.arduino.cc/index.php?topic=110485.0
http://arduino.cc/en/Tutorial/ArduinoISP
http://forum.arduino.cc/index.php?topic=104693.0

But instead of using Arduino IDE for programming I did it command line as it seemed to work better and allowed me to experiment with the commands. It's worth noticing that it took me a while to get it to work. I had to execute the same commands like ten times before something started to happen, so it's not a perfect solution but at least it worked in the end. Will post what commands I used tonight as well.

Cheers.

sunflower
 
Posts: 5
Joined: Wed Aug 29, 2012 2:41 pm

Re: x0x running super slow

Post by sunflower »

(Firts you need to follow the instructions from the arduino forum posts and patch in support for atmega162.)

So what I did was put the CPU on a breadboard together with XTAL1 (16MHz ceramic resonator) and connected as was posted in the arduino forum:

CLK (pin8) - to arduino MISO (pin13)
MISO (pin7) - to arduino MISO (pin12)
MOSI (pin6) - to arduino MOSI (pin11)
RESET (pin9) - to arduino SS (pin10)
VCC (pin40) - to arduino +5V
GND (pin20) - to arduino GND

For XTAL1 see this post:
http://www.adafruit.com/forums/viewtopi ... 117#p38117

After I had flashed the arduino with the ISP I started the terminal and run this command (this is for OSX - most likely different for other platforms) to check the connection:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -p atmega162 -c stk500v1 -P /dev/cu.usbserial-A700617s -b19200


Took me a few atempts (even tried changing parameter from stk500v1 to stk500v2 - this caused some timeout. I stopped the program and after that it seemed to be able to connect with stk500v1). After I managed to get a connection I used this command to flash "unified_SokkOS_1.9.1trimmed_CC1.0.hex" to CPU:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -p atmega162 -c stk500v1 -P /dev/cu.usbserial-A700617s -b19200 -e -U lfuse:w:0xFF:m -U hfuse:w:0xD4:m -U efuse:w:0xF9:m -U flash:w:/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/x0xb0x/unified_SokkOS_1.9.1trimmed_CC1.0.hex:i

Hope this might help someone with similar issues.

Locked
Please be positive and constructive with your questions and comments.

Return to “Making x0x”