chipKIT® Development Platform

Inspired by Arduino™

Design new board with EEPROM?

Created Thu, 16 Feb 2012 01:13:01 +0000 by KurtE


KurtE

Thu, 16 Feb 2012 01:13:01 +0000

I have been playing around with building myself a Pic32 probably based a Pic32MX795F512, with a form factor of about 3" by 2.3".

The board will probably be able to control a reasonable number of servos, and I would like the ability to store information on the board. The information that may be stored will probably change from program to program, but could include things like: servo offsets, ranges... Also possible save sequences of moves or the like. My goal is probably to have at least 32k bytes of storage available.

Suggestions for storage?

My first guess would be to add an 512kb I2C EEPROM. This is what I have done before. Any one had luck doing this?

Alternatively an SPI based EEPROM?

I wish I had room for an SD card, but with this small of a board, and my desire for as many 3 pin Servo IO connections as possible, I don't think I will have room on the board.

Again I would appreciate any suggestions you might have.

Thanks again Kurt


abotics

Sun, 19 Feb 2012 00:46:15 +0000

I have been trying to communicate with a Microchip SRAM chip using SPI, but have not had luck.

I must have something configured wrong b/c I am doing this at the register level using SPI2CONbits and other related registers. I have even duplicated some of the source from AN1277, but still can't communicate with the SRAM chip.

Abe


abotics

Sun, 19 Feb 2012 02:42:10 +0000

I just got it to work. I am using SPI2 in order to communicate with a Microchip SRAM Chip, 23K256. It appears that the jumper has to connect the two left most pins on JP4 otherwise the SS2 pin is not mapped over to pin#10 out on the connector. The AN1277 application note helps to configure the SPI2 module.

/* Configure & Turn On SPI2 for Communicating with 23K256 SRAM. */
  int spiDataRead;
  digitalWrite(spiSS2, HIGH);  // Set Chip Select Pin High.
  SPI2CON = 0;            // Stop SPI2 module & reset.
  IEC1bits.SPI2RXIE = 0;  // No SPI2 RX interrupts.
  IEC1bits.SPI2TXIE = 0;  // No SPI2 TX interrupts.
  IEC1bits.SPI2EIE = 0;   // No SPI2 Error interrupts.
  spiDataRead = SPI2BUF;  // Clear SPI2 Buffer.
  IFS1bits.SPI2RXIF = 0;  // Clear SPI2 RX interrupt flag.
  IFS1bits.SPI2TXIF = 0;  // Clear SPI2 TX interrupt flag.
  IFS1bits.SPI2EIF = 0;   // Clear SPI2 Error interrupt flag. 
  IPC7bits.SPI2IP = 1;    // Set interrupt priority to 1;
  //SPI2BRG = 0x01;          // Use Fpb/4 SPI Clock Frequency --> 80,000,000/4 = 20,000,000 Hz.
  SPI2BRG = 0x03;         // Use Fpb/8 SPI Clock Frequency --> 80,000,000/8 = 10,000,000 Hz.
  SPI2CON = 0x126;        // SPI On=0,8-bit,SMP=0,CKE=1,SSEN=0,CKP=0,MSTEN=1,DISSDI=0,STXISEL=01,STRXISEL=10.
  SPI2CONbits.ON = 1;     // Turn SPI2 module On.
  spiDataRead = SPI2BUF;  // Clear SPI2 Buffer.
  /* Upon reset the 23K256 CS must be brought low, then high. */
  digitalWrite(spiSS2, LOW);  // Set Chip Select Pin Low.
  delay(1);
  digitalWrite(spiSS2, HIGH);  // Set Chip Select Pin High.

abotics

Sun, 19 Feb 2012 03:08:54 +0000

Here is an image showing a 256Kbit Microchip SRAM, 23K256, chip wired into my UNO32 robot. Next I want to get a 1Mbit Microchip SPI EEPROM, 25AA1024, chip to work and then a C329 SPI Camera from Electronics123. Larger JPEG images won't fit on the 256Kbit SRAM, but will easily fit on the 1Mbit EEPROM chip. SPI will yield ~15 FPS on the image rate, so not too bad. Won't be able to do much processing on the PIC32, but can transfer image using WiFi connection.

Abe


KurtE

Sun, 19 Feb 2012 13:54:09 +0000

Thanks, for the feedback and sharing your progress on this.

Out of curiosity is there a reason you choose an SPI EEProm versus an I2C version?

Thanks again

Kurt


les1943

Sun, 19 Feb 2012 14:17:30 +0000

I was wondering the same thing, I have the 24LC256 eeprom working with I2C and uno32 using the examples sketch , with small modifications.


abotics

Sun, 19 Feb 2012 16:28:14 +0000

My main reason for leveraging the SPI SRAM and/or EEPROM chips has to do with speed. The SPI chips will support up to 20MHz while the I2C chips typically max out at ~1MHz. Plus I want to eventually be able to connect and communicate with the C329 SPI camera.

[url]http://www.electronics123.com/s.nl/it.A/id.3011/.f[/url]

It would have been nice to leverage the SRAM for storing image data because it doesn't require as many communication steps as when compared to the SPI EEPROM.

Abe


KurtE

Mon, 20 Feb 2012 14:18:57 +0000

Thanks, that is good information. Still need to decide which way I want to go.

Thanks again.

Kurt


xray_drifter

Tue, 01 May 2012 18:26:36 +0000

Sorry to bring this old topic up...

Hello abotics, or anyone with SPI experience... Would you mind sharing portion of your code showing sending and receiving data between UNOs? I am in need of fast data transfer between two UNOs and hence been trying to get SPI working...