Show Posts
Pages: [1]
1  Development / Other Software Development / Re: I wrote two Microchip libraries - MCP49x1 DACs and 24XX1025 EEPROMs on: December 29, 2012, 05:43:21 am
Hello, thanks for the 24xx1025 library, I hope it will be very useful to me!

I think I'll try to write in blocks of 128 bytes (each time the EEPROM is going to be used will be completely filled in 5min, so I have to reduce the number of write cicles!). Doing it in this way each operation will spend 1000 write cicles instead of 128000!

Still I have 2 questions.
1) Do I have to check / control what is the position to be written (start of page/block), or it is controlled automatically?
2) Do I have to control in my program when the write cycle has finished? I mean, do I have to use any delay?

Thanks for your feedback

Hi! smiley
1) It depends on what you mean. If you want it to be aligned (to reduce wear), you could start with setPosition to 0 (the default), and as you said write 128 bytes at a time, with write(buffer, numBytes). In this case, it tracks the current position, which will be 0, 128, 256 etc. Or, you can track it manually and use the write(address, buffer, numBytes) method.
2) No, the writes are synchronous, i.e. write() only returns when the write is finished, so it takes ~5 ms for it to return. No worries with delays or such.
2  Development / Other Software Development / Re: I wrote two Microchip libraries - MCP49x1 DACs and 24XX1025 EEPROMs on: October 04, 2012, 01:31:09 pm
The DAC library now also supports the dual channel MCP4902/MCP4912/MCP4922 chips. smiley
Aside from that, I don't think there are any noticeable differences between v1.0 and v1.1.
3  Development / Other Software Development / I wrote two Microchip libraries - MCP49x1 DACs and 24XX1025 EEPROMs on: August 12, 2012, 11:15:06 am
I made a small page for them here: http://exscape.org/arduino
... however the github repo is the one I'll 100% certainly keep up to date as changes are made: https://github.com/exscape/electronics/tree/master/Arduino/Libraries

Both are full-featured, optimized and fairly well-tested. I have more info in the READMEs (on github or in the downloads), but the brief info:

MCP49x1 DAC driver:
* Written for the MCP4901 (8-bit), MCP4911 (10-bit) and MCP4921 (12-bit) SPI DACs. Only tested with the MCP4901, but there is only *one* difference between them and the code that handles that is simple, so it should work just fine.
* Supports all the DAC features (aside from the obvious: shutdown mode to save power, and an output latch, to synchronize multiple DACs)
* Optimized for performance (has an option to not use digitalWrite, at least on the Uno/Mega boards. The rest would need minor code modifications.)

24XX1025 EEPROM driver:
* Should work with the 24LC1025, 24FC1025 and 24AA1025 chips.
* Splits writes into page writes automatically (if you have the RAM, writing the entire chip's 128 kiB at once should work)
* Helper functions to write bytes/ints/uints and floats
* Uses acknowledge polling instead of delay() to make sure the writes are made properly
* Tracks the current position for reads/writes, so you don't have to (unless you want to)

I hope someone finds them useful!
If you have any problems/bug reports/questions, contact me! smiley
4  Using Arduino / Installation & Troubleshooting / Re: No clock when using the SPI library (Uno R3) on: July 08, 2012, 02:31:04 am
and in that code, this statement won't do what is probably intended and expected:
Code:
SPI.transfer(out & 0xff00);

You have to shift the high end byte down to the low order.
Code:
SPI.transfer(out >> 8);

Pete

Ahh, goodness, and I missed that reading through the code several times. Thanks! It works now. smiley
5  Using Arduino / Installation & Troubleshooting / Re: No clock when using the SPI library (Uno R3) on: July 07, 2012, 04:29:12 pm
Setting SS to HIGH seems to not be the problem, indeed. :/
I changed SS_PIN to 9 and moved the wire, same problem.
6  Using Arduino / Installation & Troubleshooting / Re: No clock when using the SPI library (Uno R3) on: July 07, 2012, 04:05:55 pm
Oh, that easy, huh? Though in that case, I'm lost as to why the code in the link isn't working. Any ideas?

Edit: To add a few details. I've tried different clock dividers, all in range for what the chip can do (the breadboard probably limits, but <1 MHz is also a no go), as well as different modes (0/3) for clock phase and polarity. I know that the MSB should come first, so I haven't tried LSBFIRST.
7  Using Arduino / Installation & Troubleshooting / No clock when using the SPI library (Uno R3) on: July 07, 2012, 03:13:45 pm
I can't seem to get a clock signal generated on my Arduino Uno R3.
Example code includes the Examples -> SPI -> BarometricPressureSensor sketch, this one:

Code:
#include <SPI.h>

void setup() {
  pinMode(13, OUTPUT);
  SPI.begin();
}

void loop() {

}

and this one:
Code:
#include <SPI.h>

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delayMicroseconds(2);
  digitalWrite(13, LOW);
  delayMicroseconds(2);
}

The first one, with SPI.begin(), gives 0 voltage on pin 13 at all times. The second sketch with the manual square wave works.

To be honest, I don't have an oscilloscope at the moment... so I tried to measure the voltage with a DMM, with a cap in parallel to charge up. With SPI, I get 0.00 V. With the manual square wave, I get ~2.3 volts. Seems to work.

I have the full code of my actual project available here, but I don't see why it would matter if the barometer sketch doesn't work. Needless to say, this gives the same result as the ultra-boiled-down SPI code above.

Any ideas?  smiley-confuse
Pages: [1]