Show Posts
Pages: [1] 2 3 ... 6
1  Using Arduino / General Electronics / Re: SPI / Pull-Down Resistors? on: April 10, 2014, 10:12:19 pm
PS - the slave doesn't have a CS line (LPD8806) so it's a bit like the American NSA, always listening!
2  Using Arduino / General Electronics / Re: SPI / Pull-Down Resistors? on: April 10, 2014, 10:09:13 pm
Thanks, I'm glad to hear my idea wasn't crazy as I don't have a lot of experience stepping outside of basic usages shown in datasheets.

Crossroads, the micro I'm using is a 168MHz STM32 ARM so the 21MHz SPI wasn't an error.  I'm just more comfortable with this forum and figured my question was general enough for here.  Sorry to disappoint if you were hoping I had some spectacular 8bit AVR over clocking skills.  smiley
3  Using Arduino / General Electronics / SPI / Pull-Down Resistors? on: April 10, 2014, 05:57:35 pm
I have a project that involves putting the microcontroller to sleep while an SPI slave will still have power.  It's a long story to explain why but it's essentially to save the space/cost/weight required to completely cut power to the slave because of the way the entire thing is powered.  The slave draws an acceptably low amount of current in this configuration so everything is OK in that regard.

However, the sleep mode I need to put the micro in will cause the CLK/MOSI pins to float.  I'm pretty sure this will end up causing the slave to read occasional noise as data which I can't allow to happen.  My question is this: Can I just put a high value (10k?) pull-down resistor on SCK/MOSI to keep the lines from floating when the micro is asleep?  I'm running SPI at 21MHz in Mode 0 so low is idle and signal shape is pretty important at that speed.  I just don't know if this is commonly done or if I'm doing something that would be considered a crappy hack.

Any input would be appreciated!  Thanks in advance.

EDIT: If this is bad and there's a better approach you can think of I'd love to hear it.  This is just the best thing I've thought of so far.  -?-
4  Using Arduino / Project Guidance / Re: Powering Everything - General Approach Question on: April 01, 2014, 02:05:41 pm
Bump.  Any feedback on the pros/cons of my approach ideas?
5  Using Arduino / Project Guidance / Powering Everything - General Approach Question on: March 31, 2014, 01:06:55 pm
I'm working on a project with a micro and some accessories like a really small OLED, accelerometer, and maybe even a uSD card reader (space and power permitting).  I'm trying to decide on an approach to best power everything and I'd appreciate input.  The entire system will be 3.3V and run from lithium.  I'd like the micro to always be powered but cut power to the accessories completely when the micro sleeps for power savings and to be able to reset them in case of things like I2C bus hang/issues.

Major Objectives (In Priority Order)
Small footprint / fewest components
Low power consumption during micro sleep

Approach 1
A 2-channel 3V3 LDO with low quiescent current like the AP7312 ( will be used.  Channel 1 will have the enable pin always active (tired to VBAT) and used to power the micro at all times.  Channel 2 will be inactive (pull-down) and driven high only when the micro is awake to power the accessories.

Approach 2
A larger single-channel 3V3 LDO used to power the entire circuit.  A MOSFET will be used to enable power to the accessories with the gate enabled online while the micro is awake.

Approach 3
Something I haven't thought of?  Since they're only 1mA each maybe just driving them using the micro's GPIO?  This wouldn't work if I implement a uSD socket though as it draws too much current but could be viable for the OLED/accelerometer only.
6  Using Arduino / Microcontrollers / Re: How to flash bootloader *and* a sketch at the same time? on: February 01, 2013, 11:07:39 am
westfw is right about the .hex files.  You should be able to find directions here or on avrfreaks on how to merge the two hex files if you need more info.  I suggest using a hex editor such as HxD (Windows) to ensure you don't leave any stray characters but notepad should work too if you're careful.  Essentially, you'll do the following:

1. Open your firmware file and remove the entire last line beginning with the : character and including CRLF 0x10 0x13
2. Append the entire bootloader hex file contents to the end of your firmware
3. Save this new merged file as something like "MyFirmware_with_Optiboot.hex"

Once you've created this single .hex containing your firmware and optiboot you'll use avrdude to flash it in one step.  I've pasted the .bat file I use to do this below which includes everything you need to take a MCU from new/blank to ready to rock.  You'll need to customize slightly with the right ISP frequency for your programmer (-B option), the path to your firmware (-u option), COM port (-P option) and make sure those fuse settings match what you want.  It should save you a lot of time though with the syntax.  Note that this is setup to use Pololu's AVR ISP programmer (my favorite ISP programmer by far and highly recommended) and I've made a couple changes to BOD and LOCK bits from standard Arduino.  The last line (rundll) just adds a system "ding" to get your attention when it's done.

@echo off
rem Atmel Studio
rem high=0xDE
rem low=0xFF
rem extended=0xFC
rem lock=0xCC
rem -B 1 (1500 Khz, Use pololu config utility)
rem -B 2 (750  Khz, Use pololu config utility)
rem -B 3 (200  Khz, pololu programmer default)

avrdude -B 3 -v -p m328p -c avrispv2 -C c:\arduino-1.0.1\hardware\tools\avr\etc\avrdude.conf -P\\.\COM4 -b 115200 -U flash:w:"c:/Firmware/MyFirmware_with_Optiboot.hex":i -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0x04:m -U lock:w:0x0C:m
@rundll32 user32.dll,MessageBeep -1
7  Using Arduino / Microcontrollers / Atmega1284P @ 16MHz with 3.3V? on: January 04, 2013, 05:02:28 pm
I'm wanting to run the 1284P directly from lithium (4.2V peak, 3.7V nominal) with a LDO 3V3 regulator (dropout ~3.4V).  Page 325 of the Atmel datasheet ( shows the speed grades for the chip.  My first question is to ensure I understand the graph correctly.  Since it's linear it seems like a simple cross-multiplication to get the exact speed at a given voltage.  If my understanding/math is correct...

2.7V @ 10MHz (given)
3.4V @ 12.58MHz (calculated for regulator dropout)
3.7V @ 13.7MHz (calculated for lithium nominal)
4.2V @ 15.55MHz (calculated for lithium peak)

The second question is that assuming the above is correct I understand I'll be overclocking a bit at 16MHz, especially as the batteries drain.  Has anyone else done this?  Maybe with a 328P and can let me know if things went well or they had problems?  I feel like I've read that people have done this without any issue but since this is a small-run commercial product I'm working on I don't want it to be unstable.

Any advice here is appreciated -- thanks in advance!
8  Using Arduino / General Electronics / Re: Multiple Devices Connected to AVR Reset Pin on: September 12, 2012, 05:14:41 pm
@retrolefty:  Thanks for that and especially the heads-up on the diode issue.  I think I understand about the diode and will do some research and try to incorporate this.  For anyone else stumbling across this later I found what appears to be a post with great detail on what you're talking about here:,64256.msg471812.html#msg471812

@BenF: Thanks for the explanation of how that works.  I've never really understood why the cap was there but I *think* I get it now.  I'll try to find more detail on my own but this is a great starting point.  As for wanting the reset IC instead of a simple button, I already have a button tied to an input on the Atmega used to wake/sleep it.  I want the user to have to hold this same button for 10 seconds before a reset is issued to the MCU.  It's a subtle difference but I can't have a dedicated 'reset' button in my design.

If you're curious about exactly what I'm doing I'm essentially doing as shown in the schematic on Page 9, Figure 5 of the STM6503 datasheet for this smart reset IC (here:  I just needed to understand how to also retain the classic FTDI reset functionality as well without any conflict.  I think I'm almost there thanks to everyone's help!
9  Using Arduino / General Electronics / Re: Multiple Devices Connected to AVR Reset Pin on: September 12, 2012, 04:21:36 pm
As I continue to research it seems to me the magic is in whether the devices are "open drain" or "push-pull".  I've confirmed that the STM6503 is open drain (active low) and the FT232RL's DTR is push-pull.  Since the FT232RL is actually driving the line high in normal operation I have to engineer around this and can't simply connect both to the RESET input.

As long as I'm understanding this correctly, it comes down to this:  How do I include an open-drain device to pull RESET low while the FT232RL is holding it high?  I'm guessing that's a fairly easy question for someone but I'm not sure how to best approach it.  I'm still thinking maybe just a 10K series resistor on the FT232RL's DTR line?  Would that screw with its pulse too much to where it wouldn't then be able to reset the AVR?
10  Using Arduino / General Electronics / Multiple Devices Connected to AVR Reset Pin on: September 12, 2012, 03:21:31 pm
I'm designing a PCB that currently follows the older Arduino design with an Atmega328P and an FTDI FT232RL USB chip.  I've already got a working design using a 10k pull-up on the RESET pin of the MCU and an inline 0.1uF cap on the DTR line from the FT232RL to the RESET pin.  This is all very standard and works great to be able to load code via the bootloader.

However, I want to also add a reset IC (such as the STM6503) that will allow me to have a button that can be pressed and held by the user to also send RESET low to reset the MCU.  (Datasheet here:  I'm concerned that I can't just connect this STM6503 to RESET at the same time as the FT232RL.  For example, what happens when the user plugs the device in to USB and DTR/RESET is driven low by the FT232RL while the STM6503 is attached?  What happens if the user tries to hold the reset button so that the STM6503 drives RESET low while the FT232RL might be driving DTR/RESET high?

I can't find if either of these devices actually *drives* the RESET high or if it's just pulled high by the resistor and they're essentially either floating and driven low.  If the latter is the case, I can attach both with no problem, right?  If the former is the case do I need a logic gate?  ...maybe just some series resistors on these lines will do it?

I'm hoping someone can educate me a bit on how to have two (potentially) competing devices driving a RESET pin to get me started.  I just want to make it so that either of them have the capability to drive RESET low and reset the MCU at any time irrespective of what the other is doing.

Thanks in advance!
11  Using Arduino / General Electronics / Re: Push & Hold (Delay) to Hardware Reset an AVR - How To? on: August 23, 2012, 10:55:26 am
It seems like a job for a microcontroller to me.  How about an ATtiny4 that's under $0.50 in q100 ?  (PIC 10F and Freescale RS08 are also available in that price range.)

An ATtiny4 would certainly work, although you are exactly right that avoiding writing/testing/maintaining firmware is exactly what I'm after here...  especially since it's primary purpose is to bail me out in case of firmware problems.  That could be a really excellent project to start in the community though replicating this functionality on an ATtiny4.  I have a feeling it would get used a lot for a lot of battery powered Arduino projects.  I'd use it in a heartbeat and contribute if it were already built and tested!  smiley
12  Using Arduino / Microcontrollers / Re: What can I expect from my ATmega328 when the batteries run down? on: August 22, 2012, 10:33:49 pm
I wanted to add that BOD is not as simple as "on" or "off" and has multiple levels that it can be set for.  In order to determine whether you're going to get rogue instruction execution you need to make sure your clock speed matches your BOD setting.  For example, you can set a BOD of 1.8V if you're running 2Mhz or less.  You'll want a BOD of 2.7V for 8Mhz and 4.3V for 16Mhz+.  Double-check those exact numbers with the datasheet.

If you choose a BOD setting too low for your given clock speed you'll indeed get incorrect/rogue execution of instructions at some point.  Is it possible you are using the default BOD of 2.7V and 16Mhz?  That would explain the instability.  If you can slow the clock down you can run reliably at lower voltages.  The best option considering the needs of your RTC seems to be BOD of 2.7V and 8Mhz.  Try that.
13  Using Arduino / General Electronics / Re: Push & Hold (Delay) to Hardware Reset an AVR - How To? on: August 22, 2012, 09:44:37 pm
Check out the STM6600

I'm looking over the datasheet right now and it looks perfect so far.  It's even seems priced well at $1.15 @ 1k compared to some of the other pieces I've found that do far less at the same price.  Thanks for the recommendation.
14  Using Arduino / General Electronics / Push & Hold (Delay) to Hardware Reset an AVR - How To? on: August 22, 2012, 09:30:04 pm
I'm looking for a good hardware solution to implement a push-and-hold user reset for an AVR project.  I have a button that's essentially a power button tied to an interrupt on the mcu that puts it to sleep and wakes it up.  I would like to be able to allow the user to push and hold this same power button (10 seconds, for example) to do a hardware reset in case of firmware problems.  I've been told I might be able to find a supervisor IC with a programmable delay that would fit the purpose (and have very low power consumption) but my searching has only returned supervisor ICs with programmable delays in the realm of milliseconds designed to monitor battery voltage.

I'm not sure if I'm on the right path.  Can anyone give me any better terms to search for, examples, etc to accomplish this?
15  Using Arduino / Programming Questions / Re: TXEN in HardwareSerial.cpp - Where is it defined? on: August 17, 2012, 01:46:16 pm
Ug... I think I just figured it out... and I was too thick-headed to really get what you meant.  TXEN is an AVR define.  TXEN is not acting as a boolean value, that's the bit location within UCSRB.  If I understand correctly, I just need to change the sbi to cbi in HardwareSerial.begin() for my desired functionality (disabling TX by default).
Pages: [1] 2 3 ... 6