Show Posts
Pages: [1] 2
1  Using Arduino / Microcontrollers / Re: ATmega1284P: End to End using 1.0 IDE on: June 12, 2013, 01:51:20 pm
Thanx for the info. The first one is about 5x5cm I understand, but how big is the second one?
UNO sized, maybe 1cm larger on the longer side
2  Using Arduino / Microcontrollers / Re: ATmega1284P: End to End using 1.0 IDE on: June 11, 2013, 04:20:22 am
You can't just change pins_arduino.h file to suit you needs.  It has to match how the hardware pins are brought out to the headers.  You are asking for a different hardware board to match the header functions.

True, found it out the hard way today..
3  Using Arduino / Microcontrollers / Re: ATmega1284P: End to End using 1.0 IDE on: June 10, 2013, 06:41:52 pm
I wanted D0~7 to correspond to Port D pins 0~7. I tried repositioning pins as such:

D0-D7 ... PD0~7
D8 - PB0
D9 - PB1
D10 - PB4
D11 - PB5
D12 - PB6
D13 - PB7
(Port A and Port C are left untouched)
D30 - PB2
D31 - PB3

Here is my pins_arduino.h based on bobuino pins_arduino. I really have no idea how this file works so if you can take a look it will be really helpful.
4  Using Arduino / Microcontrollers / Re: ATmega1284P: End to End using 1.0 IDE on: June 10, 2013, 01:56:32 pm

I would like to ask Bob and Maniacbug about the pin-port relation.

I am using the UTFT library with a Bobuino board and from what i found up until now is that the UTFT library uses internal PORT instructions to send the data to the 8-bit data port (D0~D7) on UNO.

Arduino UNO uses PortD0~PortD7 directly with pins D0~D7, while bobuino uses PortD0~PortD3 for pins D0-D3 and PortB0-PortB3 for pins D4-D7.
I have managed to send the data output to these ports and have the LCD screen i'm using print everything correctly.

But PortB1-PortB5 are used with Digital pins 9-13 on Atmega328P and since i use some of these ports to send data to other pins, that seems to interfere internally with the output of the Digital Pins.

I found out that this is the problem by using correctly the SPI pins with a NRF24 module, but failing to use it correctly while running both RF24Network and UTFT. It actually does not work at all (no "network.available") or it works "just once", receiving a packet and sending one. And then nothing.

Having said all that, would it be smart to use Bobuino with the bootloader and settings for Mighty ATmega1284P "just to see what happens" or would it be easy to use internal port commands in order to "clear up" this mess?

@Bob, to ensure maximum compatibility with UNO you must use similar port-to-pin associations in pins_arduino.h
I believe it would not be obvious in general, but UTFT made it clear that that's a problem
5  Using Arduino / Project Guidance / Re: NRF24L01 with UNO and ATMega1284P on: June 09, 2013, 08:01:12 am
Sketch: calibration               
                     BOBUINO              |          UNO      
PIN     PORT    EDIT      NOEDIT        PORT   Voltages   
D0      PD0      0.05      0.05            PD0            0   
D1      PD1      4.31      4.36            PD1            4.44   
D2      PD2      0          0                 PD2            0   
D3      PD3      0          0                 PD3            0   
D4      PB0      0          0.06             PD4            0   
D5      PB1      4.3       0.06             PD5            4.44   
D6      PB2      0          0.06             PD6            0   
D7      PB3      0          0.06             PD7            0   
D8      PD5      0         4.39              PB0            0   
D9      PD6      3.24     3.26             PB1            3.26   
SS      PB4      0          4.36             PB2            4.44   --
MO     PB5      4.3       4.36             PB3            4.44   
MI      PB6      0          3.24             PB4            3.25   --
SCK    PB7      0          0                  PB5            0   
A0      PA7      4.3       4.37            PC0            4.44   
A1      PA6      0          0                PC1            0   
A2      PA5      4.3       4.37            PC2            4.44   
A3      PA4      4.3       4.37            PC3            4.44   
A4      PA3      2.46     2.47            PC4            2.48   
A5      PA2      -           -                PC5            -   

On this "matrix" you see:
"EDIT" means edited HW_AVR so that i send all 8 digital outputs to D0-D7 according to the other problem i had
"NOEDIT" means using the UTFT library "as is"
and UNO voltages is the voltage output of all uno pins when using UTFT.

As you can see, when i edit the UTFT library, the problem seems to be at pins 10 (D10-SS) and 12 (D12-MISO).
6  Using Arduino / Project Guidance / Re: NRF24L01 with UNO and ATMega1284P on: June 08, 2013, 10:25:31 am
From what i found today, i believe the problem stems from this.

I messed with the ports of the uC and now these are the different voltages i found out:
While on other boards or when i don't mess with the library MISO has a mean voltage of 3.2V, when i use the edited library, MISO pin drops to 0V. I believe this is the problem.
7  Using Arduino / Project Guidance / Re: NRF24L01 with UNO and ATMega1284P on: June 07, 2013, 10:09:18 am
What pin does UTFT use for slave select? Is not obvious from the code.
Am not familiar with all the libraries called out, so the connections are not clear.
Pin 10 on Bobuino is SS for Touch
Pin 8 was SS for TF, i am not using it
Pin 29 is SS for NRF24L01. Tried with pin 8, same functioning, same problem
8  Using Arduino / Project Guidance / Re: NRF24L01 with UNO and ATMega1284P on: June 07, 2013, 09:36:44 am
You don't seem to be doing anything with SPI.
Do the  librarys require you to call it out? Or do they set it up themselves?
UTFT does not seem to be using SPI, looks like it connects to a bunch of analog pins.

Is this before some of the other devices are connected? Like an SD card, which will also use SPI connections?
UTFT uses SPI for the Touch screen.
I believe the problem has something to do with the SPI bus, because sometimes when i restart the sketch it prints out some messages from a previous run of the sketch. Something might have to do with the buffer. But only on Bobuino, on UNO everything works fine.
9  Using Arduino / Project Guidance / NRF24L01 with UNO and ATMega1284P on: June 07, 2013, 08:44:57 am
I am using the following code on an arduino UNO and a Bobuino board. The ce pin on the arduino code is pin 8 and on bobuino is pin 29

 Copyright (C) 2011 James Coliz, Jr. <>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.

#include <avr/pgmspace.h>
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
#include <OneWire.h>
#include <Tictocs.h>
#include <TictocTimer.h>
#include "nodeconfig.h"
#include "printf.h"
#include "ftoa.h"

#include <SD.h>
#include <UTFT.h>
UTFT        myGLCD(ITDB32S,A1,A2,A0,A3);

// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];

// This is for git version tracking.  Safe to ignore
#ifdef VERSION_H
#include "version.h"
const char program_version[] = "Unknown";

// Pin definitions
#define __PLATFORM__ "Getting Started board"

// Pins for radio
const int rf_ce = 29;
const int rf_csn = A5;
  int i=0;
  int j=0;
  int k=0;
  int l=0;


RF24 radio(rf_ce,rf_csn);
RF24Network network(radio);

// Our node address
uint16_t this_node;

void setup(void)
  // Print preamble
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(0, 0, 0);
  // Pull node address out of eeprom
  // Which node are we?
  this_node = nodeconfig_read();
      myGLCD.printNumI(this_node, 40, 100);

  // Bring up the RF network
  network.begin(/*channel*/ 92, /*node address*/ this_node);

void loop(void)
  // Pump the network regularly
  // Is there anything ready for us?
  while ( network.available() )
    // If so, grab it and print it out
    RF24NetworkHeader header;
    char message[24];,&message,sizeof(message));
    if(header.from_node == 012)
      myGLCD.print(message, 20, 110);
      myGLCD.printNumI(k, 20, 160);
    else if (header.from_node == 022)
      myGLCD.print(message, 140, 110);
      myGLCD.printNumI(l, 140, 160);
      myGLCD.printNumI(j, 120, 190);
      myGLCD.printNumI(i, 120, 210);
  // Stop listening
  // Listen for a new node address
//  nodeconfig_listen();
// vim:ai:cin:sts=2 sw=2 ft=cpp

While on UNO it works fine and receives all messages, on bobuino all i get is either no response (the program only prints the number i on screen) or i receive one message and then there is no "network available". I have been having thoughts as to if the UTFT library conflicts with the RF24Network library (because the rf modules work fine if i check them using the serial terminal on both boards) or if it has something to do with SPI.
10  Using Arduino / Microcontrollers / Re: ATMega1284P internal functions + digitalWrite on: June 04, 2013, 12:41:57 pm
Are you using a pre written library for the n2401? Have you looked at how it
handles the CS pin?

I am using RF24Network. I'll have a look at it now. In any case, this library allows the user to choose CSN and CE pins.

edit: you were right, RF24Network is using the RF24 library which has built in code for the CE and CSN pins and uses pinmode and digitalwrite. I will have a look at it and post results! smiley-grin
11  Using Arduino / Microcontrollers / ATMega1284P internal functions + digitalWrite on: June 04, 2013, 09:19:50 am
I am using an ATMega1284P on a custom Bobuino board, with a RF24L01 radio module.

The module uses SPI and i have chosen to connect the CSN chip select pin to bobuino pin 29, which connects to ATMega1284P port C pin 7.

This port is named "PCINT23/TOSC2_PC7" and it corresponds to 1284 pin 29.

I need to use this pin to control the ON/OFF slave select of the RF module, so i have declared:


and use digitalWrite to set it HIGH or LOW. In the setup function of the Sketch i set pinMode and set it LOW so that it will be active.

My loop function is this:

void loop(void)

Where receive and send are functions for radio communication. My program loops once fine and then the chip select goes automatically to HIGH and turns off my module. I tried using digitalWrite to set the CS pin back to LOW and i see that in the beginning of the loop (second time and every time after the second) and after running each radio function the uC tries to set the pin back to HIGH and for a fraction of a second it goes HIGH and then it's set back to LOW because i give the digitalWrite LOW command.

I can't seem to understand if the CS pin is set to HIGH by default (if it happens in all sketches) or if it has something to do with the 1284P internal pin being used for some other internal function.
12  Using Arduino / Project Guidance / Re: Same project on different uCs on: May 29, 2013, 05:53:44 pm
OK! Final update. As Henning Karlsen said on this ATMega1280 tutorial, you must find which output works for each microcontroller, in his example, ATMega1280 uses ports this way:

Digital Pin 0 = PE0 (Port E - bit 0)
Digital Pin 1 = PE1 (Port E - bit 1)
Digital Pin 2 = PE4 (Port E - bit 4)
Digital Pin 3 = PE5 (Port E - bit 5)
Digital Pin 4 = PG5 (Port G - bit 5)
Digital Pin 5 = PE3 (Port E - bit 3)
Digital Pin 6 = PH3 (Port H - bit 3)
Digital Pin 7 = PH4 (Port H - bit 4)

While Bobuino uses ports this way:

Digital Pin 0 = PD0 (Port D - bit 0)
Digital Pin 1 = PD1 (Port D - bit 1)
Digital Pin 2 = PD2 (Port D - bit 2)
Digital Pin 3 = PD3 (Port D - bit 3)
Digital Pin 4 = PB0 (Port B - bit 0)
Digital Pin 5 = PB1 (Port B - bit 1)
Digital Pin 6 = PB2 (Port B - bit 2)
Digital Pin 7 = PB3 (Port B - bit 3)

So i had to go to libaries/UTFT/HW_AVR.h and insert some code in there

   void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
i added after
   #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
ends and before
this code:

#elif defined(__AVR_ATmega1284P__)
      PORTD = ((VH & 0X0F));
      PORTB = ((VH & 0xF0) >> 4);
      pulse_low(P_WR, B_WR);
      PORTD = ((VL & 0X0F));
      PORTB = ((VL & 0xF0) >> 4);
      pulse_low(P_WR, B_WR);   

and in
   void UTFT::_set_direction_registers(byte mode)
i added after
   #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
and before
this code:

#elif defined(__AVR_ATmega1284P__)
   DDRB = 0x0F;
   DDRD = 0x0F;

What these two codes do is this:
The second one defines Port B pins 0~3 and Port D pins 0~3 as output
The first one takes the VH and VL bytes and puts them in these pins.

Hope this helps anyone who uses bobuino with the UTFT code smiley-grin
13  Using Arduino / Project Guidance / Re: Same project on different uCs on: May 29, 2013, 02:07:35 pm
Post your sketch, may be a functional difference on a couple of the pins too.
Are some of those PWM outputs?
I am using any sketch from the UTFT library with an LCD screen using SSD1289 chip. Instead of getting the resulting messages/screens, i get a white glowing screen, which leads me to think that the data bus* is the one with the problem, meaning pins 4-7, which show the only important voltage differences between the two boards. I checked the voltage output from both the pins and the uC legs. There is no difference between these two, which makes me believe that the difference in uCs is what is causing the problem

*the data bus for the LCD screen are the digital pins 0-7

There is no info on the LCD user guide about the signals used

From looking in the UTFT library a little bit i think i understand that there are different structures for each mC in it. For example, there are differing codes for an ATMega328p and an ATMega1280. Isn't the ATMega1284 supposed to be "similar" to the ATMega1280? Am i supposed to "tweak" the library in order to make it think it works with an ATMega1280?
From reading the above link i found this out: ATMega328 uses PD0-PD7 pins for digital D0-D7
while ATMega1284 uses PD0-PD3 for D0-D3 and PB0-PB3 for D4-D7. I guess that's why there is no output in pins 4-7.

I checked the outputs again. From looking at the voltages that differ you get this info:

1) bobuino pin 8 is PD5 which is why it's equal to UNO pin 5 (PD5)
2) bobuino pin 9 is PD6 which is why it's equal to UNO pin 6 (PD6)
3) in general, ATMega1284 pins 18-21 are PD4-7 and are equal to UNO pins 4-7
4) While the same principle works on pins 4 and 5 on bobuino (PB0 and PB1), it does not work with the SPI pins, which already have similar outputs on both boards, even though they are different uC pins (bobuino uses PB4-7 while UNO uses PB2-5)
14  Using Arduino / Project Guidance / [SOLVED] ATMega1284P with UTFT on: May 28, 2013, 11:09:56 am
I am using this shield for I/O on an arduino UNO (ATMega328p) and a custom arduino (bobuino ATMega1284p).

On UNO it works fine, but on bobuino there is no signal, just a white screen. I thought i'd check the voltages on the uC pins and here is what i found:

      bobuino            uno   
      shield      no shield   shield      no shield
rst      4      4.6      4.08      4.7   
3.3V      3.3      3.3      3.3      3.3   
5V      4.4      4.6      4.5      4.7   

0      0.93      1      1      1   
1      2.38      2.5      2.5      2.5   
2      1.6      1.7      1.6      1.7   
3      1.11      1.18      1.1      1.2   

4      0.05      0      0.7      0.7   --
5      0.05      0      1.4      1.5   --
6      0.05      0      1.4      1.5   --
7      0.05      0      0.4      0.4   --
8      1.38      1.5      0      0   --
9      1.48      1.5      3.25      0   --

10      4.36      4.6      4.4      4.7   
11      4.36      4.6      4.4      4.7   
12      3.24      0      3.25      0   
13      0      0      0      0   

A0      2.52      2.7      2.6      2.7   
A1      1.7      1.8      1.7      1.8   
A2      3.6      3.8      3.6      3.8   
A3      4.37      4.6      4.5      4.7   
A4      2.47      0      2.5      0   
A5      0.06      0      0.07      0   

I checked both uC pins as well as board pins. As you can see, the board pins 4-9 have different voltages, something i don't understand why is happening.

The LCD uses pins 0-7 as data pins and pin 8 as TF card SS and pin 9 as Touch IRQ. The fact that the data pins have close to 0V explains why the screen is white and does not print anything.

Why two different uCs produce different signals on their pins while having loaded the same program?
15  Using Arduino / Displays / 3.2inch TFT LCD with TF card + touch: REV B! on: March 20, 2013, 11:19:14 am

I had this particular LCD, which i managed to destroy. I bought the same product from the same seller and when my new shield arrived, i found out they are now sending "Rev B" shields, which use different libraries (UTFT is a bit different and instead of the UTouch library, they use ArduCAM_Touch).

Does anybody have any idea about the pin definitions? The shield (touch mostly) is malfuntioning and i'm getting the idea that the pins are different from the V1.1 shield. For example, V1.1 used Utouch with pins (10,11,12,13,A4), now ArduCAM_Touch is only using pins (10,9) and that gives me wrong (Χ,Υ) coordinates, so the example programs do not work correctly.

I can't find the user guide for Rev B, if anyone has used it please send some info. Here is the version 1.1 user guide:
Pages: [1] 2