Show Posts
Pages: [1]
1  Using Arduino / Microcontrollers / Re: Help with Blinking LED- programming a ATTiny2313 with a MEGA 1260 or 2560 ADK on: January 09, 2012, 04:20:08 pm
Quote
is it available from the Ubuntu package repositories yet?

Please don't play games.  I asked a simple yes / no question.  A straight yes / no answer is appreciated.

I'm not playing games..  I asked because I'm not near my desktop and I update daily.  A search shows http://packages.ubuntu.com/source/natty/arduino  arduino (0022+dfsg-1)

2  Using Arduino / Microcontrollers / Re: Help with Blinking LED- programming a ATTiny2313 with a MEGA 1260 or 2560 ADK on: January 09, 2012, 03:02:00 pm

Are you using Arduino 1.0 IDE?

  is it available from the Ubuntu package repositories yet?   That quote in my last post was from this page: http://arduino.cc/en/Main/ArduinoBoardADK
3  Development / Suggestions for the Arduino Project / Re: minimalistic mode for smaller memory on: January 09, 2012, 01:07:06 pm
What are you pointing out there?

I didn't bother troubleshooting past removing all lines of code. serial.begin makes the sketch take up around 1K of the available memory.   It does not seem like it should be that large.  UART is a very simple protocol.
4  Development / Suggestions for the Arduino Project / minimalistic mode for smaller memory on: January 09, 2012, 09:47:30 am
I wrote a simple sketch to be run with the ArduinoTiny project.  The target is an ATTiny2313.   The simple sketch came out to be 4200Bytes. When written in C code, its only 800.  

I'd like to suggest a checkbox that will compile a sketch in minimalistic mode.  

Here is the code which I am talking about.

Code:
/*
Barnes and Nobel Nook Tablet Mod Chip
 Copyright 2011 Adam Outler - hkvc
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -Adam Outler  adamoutler, gmail.com
 
 */

boolean Position[3]={true,true,true};//Place holders for operation
int inByte; //current byte
String Message=""; //current string of bytes
//begin sketch

void setup() {
  Serial.begin(115200); //Initialize UART and set baud for serial
  Serial.println("I are your god now");
  }
void loop() {
  if (Serial.available()) {
    inByte = Serial.read();
    if ( inByte == 10 ){
      Message="";
    }
    else {
      Message=Message +(char)inByte; //dump char into string
      if (Message == "OMAP44XX SDP # "){
        if ( Position[1]){
          Serial.println("O hai Nook Im in ur memory");
          Serial.println("mmcinit 0; fatload mmc 0:1 0x81000000 new.flashing_boot.img;");
          Serial.println("Mai kernel is ur kernel");
          Position[1]=(!Position[1]);
          return;

        } else if ( Position[2]){
          Serial.println("Ur Security is my target");
          Serial.println("mw.l 80e84794 e1a00000; mw.l 80e847fc e1a00000; mw.l 80e84808 e1a00000; mw.l 80e847a0 e1a00000;");
          Serial.println("Ur Security is neutralized");
          Position[2]=(!Position[2]);
          return;
        }
        else if ( Position[3]){
          Serial.println("boot mai kernel now");
          Serial.print("booti 0x81000000");
          Serial.println("k thx bai");
          Position[3]=(!Position[3]);
          return;
        }
      }  
    }
  }
  if (millis()>=60000){
    lockup;
  }
}
void lockup(){
  while(true){
    delay(50000);//program cannot end, only sleep
  }
}

The basic gist of this program is to monitor for a string, then respond with one of 3 strings.  I added some extra stuff into it as well.    

The problem is that this compiles over 4K and it does not need to be more than 1K.  Here's a similar program written in all C.

Code:
#include <avr/io.h>
#include <avr/pgmspace.h>

// Use a 3.6864MHz clock
#define F_CPU   3686400UL
#define BAUD   115200UL

// Must be loaded after defines above
#include <util/setbaud.h>

// These strings won't fit in RAM
char LOADMMC[] PROGMEM = "mmcinit 0; fatload mmc 0:1 0x81000000 new.flashing_boot.img;";
char OPCODES[] PROGMEM = "mw.l 80e84794 e1a00000; mw.l 80e847fc e1a00000; mw.l 80e84808 e1a00000; mw.l 80e847a0 e1a00000;";
char BOOTCMD[] PROGMEM = "booti 0x81000000";

void uart_putchar(char c) {
   // Wait until transmitter ready
   loop_until_bit_is_set(UCSRA, UDRE);
   UDR = c;
}

void uart_puts_progmem(char *s) {
   char b;
   // While the byte read from flash isn't a null byte, keep sending
   while ('\0' != (b = pgm_read_byte(s++))) {
      uart_putchar(b);
   }
}

void init_uart() {
   // Set baud rate using setbaud macros
   UBRRH = UBRRH_VALUE;
   UBRRL = UBRRL_VALUE;
   #if USE_2X
   UCSRA |= _BV(U2X);
   #else
   UCSRA &= ~_BV(U2X);
   #endif
  
   // Enable receiver/transmitter
   UCSRB = _BV(RXEN) | _BV(TXEN);
  
   // TxD pin PD1 set to output
   DDRD |= _BV(PD1);
   // RxD pin PD0 set to input
   DDRD &= ~_BV(PD0);
}

void send_string(int i) {
   switch (i) {
      case 0:
         uart_puts_progmem(BOOTCMD);
         break;
      case 1:
         uart_puts_progmem(OPCODES);
         break;
      case 2:
         uart_puts_progmem(LOADMMC);

         // Disable interrupts and put the micro to sleep - it will never wake up ( :( )
         asm("CLI");
         MCUCR |= _BV(SM1) | _BV(SM0) | _BV(SE);
         asm("SLEEP");
         break;
   }
}

int main(void)
{
   char c;
   int state, i;
  
   // Turn off peripherals we aren't using
   PRR |= _BV(PRTIM1) | _BV(PRTIM0) | _BV(PRUSI);

   init_uart();
  
    while(1)
    {
      // Use a state machine to detect the prompt
        if (UCSRA & _BV(RXC)) {
         c = UDR;
         switch (state) {
            case 0:
               if (c == 'S') state++;
               break;
            case 1:
               if (c == 'D') state++;
               else state = 0;
               break;
            case 2:
               if (c == 'P') state++;
               else state = 0;
               break;
            case 3:
               if (c == ' ') state++;
               else state = 0;
               break;
            case 4:
               if (c == '#') state++;
               else state = 0;
               break;
            case 5:
               if (c == ' ') send_string(i++);
               state = 0;
               break;
         }
      }
    }
}

It seems to me that size would be a concern when prototyping.  

Thanks for reading and considering this proposal for a minimalistic compilation option.
5  Using Arduino / Microcontrollers / Re: Help with Blinking LED- programming a ATTiny2313 with a MEGA 1260 or 2560 ADK on: January 09, 2012, 09:30:26 am
Damnit....  smiley-mad 

Code:
USB Host: MAX3421E. The MAX3421E comunicate with Arduino with the SPI bus. So it uses the following pins:
Digital: 7 (RST), 50 (MISO), 51 (MOSI), 52 (SCK).
[b]NB:Please do not use Digital pin 7 as input or output because is used in the comunication with MAX3421E [/b] Non broken out on headers: PJ3 (GP_MAX), PJ6 (INT_MAX), PH7 (SS).


So the Arduino ADK is incompatible with the ArduinoISP example.

As soon as the programming starts, pin 7 goes low and resets the communications?
6  Using Arduino / Microcontrollers / Help with Blinking LED- programming a ATTiny2313 with a MEGA 1260 or 2560 ADK on: January 08, 2012, 12:04:14 am
Problem: I am trying to blink an LED on a ATTiny2313.  All I see is "Programmer not responding".
Conditions: I have an Arduino MEGA2560 ADK and an Arduino MEGA1260ADK for use as an ISP programmer.    I would prefer to use Arduino IDE if possible.
I've tried:
Troubleshooting my electrical setup and verified the pinouts.
Arduino-Tiny- http://code.google.com/p/arduino-tiny/  - This fails quietly in Arduino IDE.  It only tells me the programmer is not responding.
Roloxu Blog- http://www.roxlu.com/blog/entry/59/attiny2313avrdude-and-arduino-avrisp
With tweaking to the Makefile for AVRDude from Roloxu Blog, I was able to produce this output from AVRDude - http://pastebin.com/1DaG5g2p

Here is a picture of my setup

Here is my source, including avrdude, raw C, and Arduino PDE for blink: http://www.mediafire.com/file/d177g0nreql9lhr/2313Blink.zip



I would greatly appreciate any help. Preferably, help in getting it working with Arduino IDE.  My Arduino Megas just go dead and do not really tell me anything when they fail. The indicator lights stop pulsing, and eventually the Arduino will freeze or restart.  What do I have to do to make an LED blink on an ATTiny2313A?
7  Using Arduino / Programming Questions / Re: How to JTAG with Arduino? on: April 19, 2011, 03:56:51 pm
What Arduino version do you have? Uno or older?
I have an ATMega.  1280 I think.   I know JTAG should be possible with the wiring library.  If it can be done with a slow paralell port, it has to be possible with an 18mhz Arduino.  JTAG is possible.  I just need a library or program to use.

I have the data and a memory location to write.  I just need an interface to write it with.  JTAG works.  All I need is a program for the Arduino.   I don't have a paralell port on my computer, or it would be pretty easy.
8  Using Arduino / Programming Questions / How to JTAG with Arduino? on: April 18, 2011, 10:51:04 pm
I've been doing alot of work on my phone....  Way too much to go into here. 

Anyways.. I'm about to brick my phone while testing something.    I need to use JTAG to bring my phone back to life.  Does anyone know of some code that can run on an ATMega to perform JTAG uploading of a firmware?
9  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial to Serial connection on an ATMega on: April 18, 2011, 08:52:11 am
it's working!

http://youtu.be/GGrFAU1sig8
10  Using Arduino / Interfacing w/ Software on the Computer / Serial to Serial connection on an ATMega on: April 13, 2011, 10:42:02 pm
I'm trying to access a USB 3.3v UART port on my samsung captivate.  see here: http://forum.xda-developers.com/showthread.php?t=1018862

Anyways, I need to make sure I'm doing this right.   Basically, I want to talk directly to it using my computer. The problem is all I get is garbage through the other end while other people are getting real data.  How can I go about emulating a USB UART device with the Arduino?  As far as hardware goes it should be able to handle it.  Every time I search for UART, i get the serial() command used in various contexts.

Here is my code
Code:
void setup() {
  // initialize both serial ports:
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.print(inByte, BYTE);
  }
  if (Serial.available()) {
    int inByte = Serial.read();
    Serial1.print(inByte, BYTE);     
   
  }
}
Can someone help me communicate with my ATMega to my UART connection?
11  Using Arduino / Project Guidance / Re: How to use Arduino as JTAG? on: March 29, 2011, 12:16:38 pm
I found something on the dd-wrt forums.  http://www.dd-wrt.com/phpBB2/viewtopic.php?p=435604&sid=ddb4b035b95dee2dd715141d9de787e6

I can't download it from here on my phone,  but I will try later tonight.
12  Using Arduino / Project Guidance / How to use Arduino as JTAG? on: March 29, 2011, 11:17:48 am
I've read online that it is possible to use Arduino as a JTAG programmer.   I was not able to find a how-to or a sketch to play with.   I would like to be able to use my Arduino ATMega to read and replace data on my phone.

Here is the board which I am trying to flash http://www.jtagbox.com/downloads/manuals/i897/i897_pinout.jpg  .  It has standard JTAG pins.   Just like a Linksys Router  http://oldwiki.openwrt.org/attachments/OpenWrtDocs(2f)Hardware(2f)Linksys(2f)WRT54GL/wrt54gl_v11_jtagport___.jpg.   

I'd rather use Arduino and then help others to do the same rather then buy a $150 usb JTag programmer, or waste $50 on a parallel port and cable which I must destroy to complete this project.  it seems cleaner and more effective to use a general purpose Arduino. 

I'm absolutely positive that it is possible and it has been reported that JTAG has been done with the Arduino.  I would like to know how though.   I'm an exprienced sketcher and developer.  Any help, links, thoughts or suggestions would be appreciated.   

Pages: [1]