Show Posts
Pages: [1] 2
1  Using Arduino / Microcontrollers / Re: Why does adding an entry to my boards.txt remove another board from the list? on: January 25, 2014, 03:36:41 am
Oh wow.  Can't believe I missed that.  Thanks!
2  Using Arduino / Microcontrollers / Why does adding an entry to my boards.txt remove another board from the list? on: January 24, 2014, 07:40:50 pm
I have a custom board that uses the TQFP 32 pin 328P.  The device signature appears to be slightly different than the Uno's part.  To that end I modified my boards.txt file and added the following:

#############################################################
uno.name=Arduino_Uno_Modified
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xe2
uno.bootloader.high_fuses=0xda
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328_mod.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=8000000L
uno.build.core=arduino
uno.build.variant=standard

I should mention that I want to use the internal 8 MHz oscillator hence a few other changes.  When I add this to my boards.txt I see the "Arduino_Uno_Modified" option as expected, but for whatever reason I no longer see the Arduino Uno option.  Any suggestions as to why this is?  Thanks,

D
3  Using Arduino / Programming Questions / Re: Serial.parseInt bug on custom mega board? on: October 16, 2013, 07:02:22 pm
Thanks for the reply.  parseInt() is indeed called only after the first character is read out.  The function first checks whether there are any bytes available, then reads the first character, and then calls parseInt().  For kicks (and to make it user, er me, proof) I added a secondary Serial.avaliable() check after first char is determined to be i such that there must be a number entered after the i.  The input data is coming from the arduino IDE serial monitor with no line ending.  Thanks!
4  Using Arduino / Programming Questions / Serial.parseInt bug on custom mega board? on: October 16, 2013, 06:40:58 pm
Hi There,

I recently spun a custom mega board (based on the mega schematic).  I'm having a super bizarre problem related to serial i/o.  I've used the parseInt() function several times on an uno board without issue, but for some reason I'm getting some very strange behavior.

I've written a function pasted below, which is meant to service a command depending on what character it reads from the serial port.   I've simplified the function to focus on the issue at hand, which is basically that I'm not getting expected behavior from parseInt().

Code:
void serviceCmd(){
  int num;
  if(Serial.available() > 0){
    char firstChar = Serial.read();
    if(firstChar == 'i'){
      num = Serial.parseInt();
      Serial.print(num);
      byte readByte;
      Serial.println();
      Serial.print(Serial.available());
      Serial.println(" bytes left...");
      while(Serial.available() > 0){
readByte = Serial.read();
      }
    }
    else{
      Serial.print("Got unknown command: ");
      Serial.println(firstChar);
      byte readByte;
      while(Serial.available() > 0){
readByte = Serial.read();
Serial.print(readByte, DEC);
      }
    }
  }
}

I'd expect that if I enter "i 1234" to the terminal I should get back "1234".  Here's a sample of what I enter and what I get:

Enter: "i123"
Get back:
0
0 bytes left...

Enter: "i 1234"
Get back:
2
2 bytes left...

Enter: "i 5678"
Get back:
6
2 bytes left...

Enter: "i 9999"
Get back:
9
2 bytes left...

Enter: "i 1"
Get back:
0
0 bytes left...

Any suggestions here?  This seems super strange to me.  I'm clearly able to get data from the serial port without a hitch and I'm able to send data to the serial port, but for some reason parseInt just isn't giving me what I'd expect in any way shape or form.

Thanks!
5  Using Arduino / Microcontrollers / Re: atmeg2560 board on: October 07, 2013, 01:08:40 pm
I see.  Thanks so much for the reply.  I am indeed using a usbtiny programmer.   Thanks for the info!
6  Using Arduino / Microcontrollers / atmeg2560 board on: October 04, 2013, 04:10:53 pm
Hi There,

I recently designed a board around the atmega2560 running at 3.3V and 8 MHz.  I'd like to use the internal RC oscillator at 8 MHz.  In the boards.txt file I added the following:

Code:
mega2560_no_extclk.name=Arduino Mega 2560 w/ Internal 8MHz RC

mega2560_no_extclk.upload.protocol=wiring
mega2560_no_extclk.upload.maximum_size=258048
mega2560_no_extclk.upload.speed=115200

mega2560_no_extclk.bootloader.low_fuses=0xE2
mega2560_no_extclk.bootloader.high_fuses=0xD8
mega2560_no_extclk.bootloader.extended_fuses=0xFD
mega2560_no_extclk.bootloader.path=stk500v2
mega2560_no_extclk.bootloader.file=stk500boot_v2_mega2560.hex
mega2560_no_extclk.bootloader.unlock_bits=0x3F
mega2560_no_extclk.bootloader.lock_bits=0x0F

mega2560_no_extclk.build.mcu=atmega2560
mega2560_no_extclk.build.f_cpu=8000000L
mega2560_no_extclk.build.core=arduino
mega2560_no_extclk.build.variant=mega

The only difference between this and the default mega2560 entry is that I've changed the build.f_cpu to 8 MHz and I've changed the low fuse to reflect the 8 MHz RC oscillator.

When I try to burn the bootloader I get the following error:

Quote
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 197.19s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x3e000
         0x0d != 0xff
avrdude: verification error; content mismatch

Any thoughts or ideas?  What am I missing/doing incorrectly?  Thanks!

D
7  Using Arduino / Displays / Can the RS pin for a 16x2 character LCD be controlled by an "analog" out? on: August 13, 2013, 05:08:53 pm
I have a 16x2 character LCD from sparkfun (https://www.sparkfun.com/datasheets/LCD/GDM1602K.pdf).  I'd like to use the liquidcrystal library to drive it.  I've never had any problems in the past with this display or the library, but now I'm trying to use pin A3 to drive RS.  The display isn't showing anything (backlight works, but other than that nothing else).  I looked with my scope at RS and I see that it's always low.  I looked at the liquidcrystal.cpp file and I see that RS should be toggled.  Any reason that using A3 is a no-no?  All the examples use 12, but I can't see why this makes any difference.  Thanks.

D
8  Using Arduino / Microcontrollers / Re: atmega328-mmh and arduino? on: July 29, 2013, 04:31:01 pm
Burning the bootloader was the solution.  Thanks for the help.
9  Using Arduino / Microcontrollers / Re: atmega328-mmh and arduino? on: July 27, 2013, 05:01:45 pm
Thanks so much for the fast replies!  I will try that later this weekend when I've got the HW in front of me.  Much appreciated guys!

D
10  Using Arduino / Microcontrollers / Re: atmega328-mmh and arduino? on: July 27, 2013, 04:07:13 pm
Thanks a lot for the reply (and for deleting the duplicate post)!  Turns out that I apparently had a cold solder joint (that package is pretty small for hand soldering).  I now successfully blink an LED though I observe that delay(n) results in a delay that's actually 16n.  So delay(10) results in a delay that's 160 mS.  I'm using the same resonator that's found on the uno (murata CSTCE16M0V53-R0).  Some more debugging is probably needed, but it would seem that the arduino is operating at 1 MHz and not 16 MHz -- or at least that's an obvious theory.  Are there any particular reasons that this behavior would be exhibited?  I can't see how any timing registers would have changed.  Thanks!

D
11  Using Arduino / Microcontrollers / Re: atmega328-mmh and arduino? on: July 26, 2013, 10:48:51 pm
Sorry for the duplicate post -- slow internet + browser forward/back don't mix well.
12  Using Arduino / Microcontrollers / atmega328-mmh and arduino? on: July 26, 2013, 10:48:07 pm
I recently spun a board with an atmega328-mmh.  I'm trying to program it with the ISP.  I modified the avrdude.conf file so that the device signature would match that of atmega328-mmh (and not the default atmel part on the uno board).  The arduino IDE claims that everything programmed fine.

First thing I'm trying to do is just blink an LED -- it's not functioning (the code is fine/works on other arduino boards).  I'm wondering how the arduino ide handles different chip packages.  For example my led is on pin 11 of the 328-mmh, which corresponds to PB1.  PB1 on the 32 pin MLF part is pin 13.  Does the IDE/compiler translate the I/O (e.g. Arduino pin 9) to PB1 or does it need to know something about the physical pin assignments on the atmel part?  In other words can I even program the 328-mmh by faking an Uno board or are all the I/O assignments going to be botched?  Thanks!

D
13  Using Arduino / Programming Questions / Re: External Interrupt and LiquidCrystal on: November 28, 2012, 06:36:11 pm
Well this is an embarrassing bug.  I had a led on the output of the switch.  The current draw of the led was such that I had a large voltage drop on the 10k pullup.  That led me to have a V that sat right in the undetermined middle of the 0-5, which triggered tons of random interrupts.  Unclear at this point why lcd related commands caused different behavior vis-a-vis amount of interrupting, but seemingly problem solved.
14  Using Arduino / Programming Questions / Re: External Interrupt and LiquidCrystal on: November 28, 2012, 04:51:05 pm
To Nick:  the state of the lcd is inconsequential right now -- you can change from clear() to print(someval) and you'll get the identical behavior.  The question is why does calling something LCD related seemingly trigger my ISR?
15  Using Arduino / Programming Questions / Re: External Interrupt and LiquidCrystal on: November 28, 2012, 04:45:01 pm
To Nick: yes I have a pullup.  The switch is debounced with a 1k pull up to +5V and a .1uF cap to GND.

To Liudr: Per my original post clear() is simply an example.  Functionality is identical if I print a value to the LCD, which is the ultimate goal.
Pages: [1] 2