Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: ov7670 with both arduino uno and now mega on: August 20, 2014, 11:27:47 pm
Mr Arduino,

Thanks, I finally was a able to get a good image! I think part of my problem was the synchronization of the serial port. It takes a few pics for it to lock in, at least when using Realterm. Thanks again for all the information you provided, it was very helpful in getting this camera to work.

-diesel
2  Using Arduino / Sensors / Re: ov7670 with both arduino uno and now mega on: August 15, 2014, 12:15:03 am
Hello,

I am trying to get Arduino Uno with the OV7670 w/o FIFO to run https://github.com/ComputerNerd/ov7670-no-ram-arduino-uno. I am sending data at 1mbs to the serial port, for vga I get 30720 bytes(taking out the "RDY") statement. I have also tried the other resolutions and get a consistent amount of bytes. Clock is on pin 11, running at 8 mhz, output voltage 3V (going thru a 74HC244..also tried 74LVC245). A4 (SDA) and A5 (SCL) have a 4.7kohm pullup resistor to 3.3V. I also removed the pullups in the twi library. I verified that PLCK has an output signal. All the rest of the connections look good. I am using Realterm to capture the serial data. It writes this data directly to a file. I have tried converting over a "useQvga" image like so:
ffmpeg -f rawvideo -s 320*240 -pix_fmt yuvj422p -i frame0.yuv -f image2 -vcodec png img.png
I get a green screen, nothing that looks like a picture image. I have also used a couple other utilities that I found, but they do not produce an image either. One of which converted the image into grayscale, looks similar to static on tv . So, I am not sure what I am doing wrong here. If anybody can provide some insight I would be interested. By the way, I also tried another camera, similar results.

Also, Mr Arduino, you posted below about your data-converter, I would like the windows binary if you could post it? I am having trouble getting the data-converter to compile on my win 7 machine. I think it is related to a problem with the libpng library. Perhaps your converter would help me produce a good image.

"Yes it is here https://github.com/ComputerNerd/RawCamera-data-converter one thing I was wondering should I release windows binaries with it or not? How many people here use windows here?

Thanks,

-diesel
3  Using Arduino / Programming Questions / Trouble with Serial1 port in SPI mode - Port mapping problem on 2560? on: March 02, 2013, 03:56:53 am
Hello,

I am using a Seeduino Mega 2560 mega. Very similar to Arduino mega 2560, except it has accessible headers for some of the pins that are not accessible on the Arduino mega. I am able to run the 1st serial port(Serial) in SPI mode, but I am having trouble running the 2nd serial port(Serial1) in SPI. I suspect it has to do with the missing port mappings when IDE compiles the code, but I am not sure how to fix. Can somebody give me a hint or lead on how to fix problem? 

Thanks,

-diesel

//Init
UBRR1H = 0;                                   
UCSR1A = _BV (TXC1);               
XCK1_DDR |= (1<<XCK1);                   
UCSR1C = _BV (UMSEL10) | _BV (UMSEL11);
UCSR1B = _BV (TXEN1) | _BV (RXEN1);   
UBRR1H =0;

//Transfer byte
while (!(UCSR1A & _BV (UDRE1)));
UDR1 = _data;
while (!(UCSR1A & _BV (RXC1)));
return UDR1;



4  Using Arduino / Storage / Re: SPI Sram with pointers? on: February 19, 2013, 12:49:59 am
Paul,

I am trying to use the sram with the uip network stack, which uses an a pointer to an internal sram array to compose and parse packets. I would like to use external sram instead.

Pito,

Thanks for the info, sounds interesting, the examples are what I am looking for, but I am not sure how to implement that. Yes, I agree, that would be great to have in the Arduino environment.

Thanks,

-diesel
5  Using Arduino / Storage / SPI Sram with pointers? on: February 17, 2013, 11:14:15 pm
Hello,

I recently received some 23LC1024 chips. They are 5V 1Mbit spi sram chips that I am using with an Arduino 328p. I found a library online that is pretty good http://code.google.com/p/arms22/downloads/detail?name=SPISRAM-001.zip (which I modified for 24 bit addressing). This library is nice in that it lets you address the memory as if it were an array, like myarray[address]=#, however, I was wondering is there another programming technique that I could use to work with the sram as a pointer? Could I overload operators in the library to simulate a pointer type interface? I have read that other Atmel chips have the ability to address external memory as if it were internal, but it doesn't look like this is an option with the 328p. Am I wrong, is it possible to use the XYZ registers to address the memory like a pointer?  

Thanks,

-diesel
6  Using Arduino / Networking, Protocols, and Devices / Re: Setting up the second SPI port on the Arduino Uno on: February 13, 2013, 01:34:47 am
Nick,

Thanks I will give that a try. I confirmed it was xck0 pin not being accessible that was the problem on the arduino mega. Bought a seeduino mega board that has the xck0(pe2) accessible, got spi on uart working on this board.

Another question, can you switch uart line back over to serial mode by just doing Serial.begin(#)? I would think you could. Should you make any other register changes?

Thanks,

-diesel

7  Using Arduino / Networking, Protocols, and Devices / Uart port in SPI mode on Arduino Mega 1280 on: February 08, 2013, 03:12:50 pm
Hello,

I was able to operate the Uart port in SPI mode on the Arduino 328. However, when I try to run on the Arduino Mega 1280, I am unable to get it working. I believe the issue is because xck0 line is not routed to pin 4(or any pin for that matter). In fact, none of the xck# lines are routed to pins. It seems odd that none are routed to pins. Is there a way to access the functionality of these pins from another accessible pin? Could an interrupt be used?

Thanks,

-diesel
8  Using Arduino / Networking, Protocols, and Devices / Re: Setting up the second SPI port on the Arduino Uno on: February 08, 2013, 12:00:15 am
Nick,

OK, I will look around and see if someone has done something like that. Thanks for your help!!

-diesel
9  Using Arduino / Networking, Protocols, and Devices / Re: Setting up the second SPI port on the Arduino Uno on: February 07, 2013, 11:39:10 pm
Nick,

I can start a new post if you like? I think that I have found the problem. XCKO is not mapped to an accessible pin. Ref. http://arduino.cc/en/Hacking/PinMapping2560 (which I believe has the same mapping as the 1280). If you search on XCK, none are mapped to an accessible pin. Are there any options of accessing the function of those pins?

Thanks,

-diesel
10  Using Arduino / Networking, Protocols, and Devices / Re: Setting up the second SPI port on the Arduino Uno on: February 07, 2013, 10:33:20 pm
Nick,

I hooked up the SPI ram, it works on the arudino 328p, which is great, thanks! Unfortunately, I can't get it working on the mega 1280. The registers and bits seem to be the same. I looked over the datasheets for the 328 and the 1280, they both look same w/regards to UART in SPI mode. Do you know what maybe the problem?

Thanks,

-diesel
11  Using Arduino / Networking, Protocols, and Devices / Re: Setting up the second SPI port on the Arduino Uno on: February 07, 2013, 12:50:14 am
Nick,

I put a logic analyzer on both so that you could see. I attached two images, 1st with Uart SPI and 2nd with Arduino std SPI. On the Uart SPI I get 255...255,\r,\n from serial. Nothing but 255 for the array of characters. On the Arduino std SPI I get ->hello there \r\n(although not perfect). The best software serial baud seemed to be 38400, I ranged from 9600-115200( best defined by what I received from Arduino SPI) . I also tried connecting the Arduino up with only 9v power supply, disconnecting usb, I thought that might be giving me interference, no change in output, still 255 from Uart SPI. Any other suggestions? I have a arduino mega 1280, perhaps I could give that a try w/the 2nd hardware serial port. Would I have to change the registers?

Thanks,

-diesel
12  Using Arduino / Networking, Protocols, and Devices / Re: Setting up the second SPI port on the Arduino Uno on: February 06, 2013, 10:08:30 am
Nick,

The plan is to use the secondary spi port to use with SPI ram. First, I want to make sure it is working, so now I am just reading and writting from SoftwareSerial. I am attempting to write and read into the SPI port, which works using the hardware spi.

Thanks, I will give the higher baud rate a try.

-diesel

13  Using Arduino / Networking, Protocols, and Devices / Re: Setting up the second SPI port on the Arduino Uno on: February 06, 2013, 12:12:32 am
Nick,

I was messing around with code trying to get it to work, that is why they were different.

I modified as you suggested, but same output......,......,. I did switch back to my first listed code and noticed for a short period of time it would output ......., .......,  then it went back to hello there. Maybe it is a timing thing? I saw something in the datasheet that it talks about setting up interrupts, are those necessary?

Thanks,

-diesel
14  Using Arduino / Networking, Protocols, and Devices / Re: Setting up the second SPI port on the Arduino Uno on: February 05, 2013, 10:50:44 pm
Nick,

Thanks for posting the code to create SPI port on uart pins. I am, however, having a problem with it. I tried setting up a simple test. I am using an Arduino Uno w/no devices attached. Since I was having a problem, I tried this simple test using std SPI library, works as you would expect. I am using FTDI breakout from Sparkfun to read. hello there, hello there....

Code:
#include <SPI.h>
#include <SoftwareSerial.h>
SoftwareSerial DebugPort = SoftwareSerial(2,3);

char mystring[100]="hello there";
char mystring2[100]="";
void setup() {
  // put your setup code here, to run once:
  DebugPort.begin(9600);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  SPI.setClockDivider(SPI_CLOCK_DIV2);
  SPI.setDataMode(SPI_MODE0);
}

void loop() {
  uint8_t x=0;
  digitalWrite(SS,LOW);
 for(x;x<(strlen(mystring));x++){
  mystring2[ x ] = SPI.transfer( mystring [ x ] ) ;
 }
 digitalWrite(SS,HIGH);
 mystring2[x+1]='\0';
 DebugPort.println(mystring2);
}

*************
Then I tried a similar setup using the code you posted. On this I get an output of ......,......,...... (yes dots). Do you know what may be the problem?
************



Code:
#include <SoftwareSerial.h>
SoftwareSerial DebugPort = SoftwareSerial(2,3);
const byte MSPIM_SCK = 4;
const byte MSPIM_SS = 5;
char mystring[100]="hello there";
char mystring2[100]="";
// sends/receives one byte
char MSPIMTransfer (char c)
{
  // wait for transmitter ready
  while ((UCSR0A & _BV (UDRE0)) == 0)
    {}
    
  // send byte
  UDR0 = c;
  
  // wait for receiver ready
  while ((UCSR0A & _BV (RXC0)) == 0)
    {}
    
  // receive byte, return it
  return UDR0;
}  // end of MSPIMTransfer

// select slave, write a string, wait for transfer to complete, deselect slave
void spiWriteString (const char * str)
  {
  if (!str) return;  // Sanity Clause
  
  char c;

  // enable slave select
  digitalWrite (MSPIM_SS, LOW);
 // const char * mystr = str;
  uint8_t count =0;
  // send the string
  while (c = *str++){
   mystring[count] =MSPIMTransfer (c);
  }

  // wait for all transmissions to finish
 while ((UCSR0A & _BV (TXC0)) == 0)
    {}

  // disable slave select
  digitalWrite (MSPIM_SS, HIGH);
  }  // end of spiWriteString
 
void setup()
  {
  DebugPort.begin(9600);
  pinMode (MSPIM_SS, OUTPUT);   // SS
  // must be zero before enabling the transmitter
  UBRR0 = 0;
  UCSR0A = _BV (TXC0);  // any old transmit now complete
  pinMode (MSPIM_SCK, OUTPUT);   // set XCK pin as output to enable master mode
  UCSR0C = _BV (UMSEL00) | _BV (UMSEL01);  // Master SPI mode
  UCSR0B = _BV (TXEN0) | _BV (RXEN0);  // transmit enable and receive enable
  // must be done last, see page 206
  UBRR0 =3;// 3;  // 2 Mhz clock rate
  }  // end of setup

void loop()
  {
    
      uint8_t x=0;
  digitalWrite(MSPIM_SS,LOW);

 for(x;x<(strlen(mystring));x++){
  mystring2 [ x ] =MSPIMTransfer( mystring  [ x ] );
 }
 digitalWrite(MSPIM_SS,HIGH);
  mystring2[x+1]='\0';
  DebugPort.println(&mystring2[0]);  
}

Thanks,

-diesel

Moderator edit: [code] ... [/code] tags added. (Nick Gammon)
15  Using Arduino / Networking, Protocols, and Devices / Re: SPI question - Scope of slave pin(s) on: February 04, 2013, 12:41:55 am
Hello,

Thanks for the replies. I think that I understand. I thought pin 6 could interfere with SPI communication, but for that to happen it would need to be hooked up to miso,mosi, and clk otherwise it has no effect on the spi port.

Thanks,

-diesel
Pages: [1] 2 3 4