I'll try to keep the introduction short then get to the meat of the post quickly.
I started with the Basic Stamp 2, loved it... moved to Microchip's PIC lines 16F628A and the like. I liked them, it was fun, but still not quite the muscle I was looking for. I tried out the PIC32 line of micro controllers and got the PIC kit 3 and was so utterly frustrated and unhappy with my purchase. I saw the "100% Arduino compatible" OSEPP products in Fry's electronics store and impulsively purchased the UNO and Mega 2560.
I know the OSEPP products aren't actual "Arduinos" and that they are supsoedly 100% compatible. So I wanted to see if I could get some help with an SPI problem I'm having with the Mega. I haven't tried the UNO's SPI to see if it's just me, my circuit or an actual problem with the OSEPP Mega 2560.
Essentially the problem is this:
I include the SPI.h in my program, I set the mode to 0, bit order to MSB, and clock divider.
The pin modes and assignments are already made and dictated in the library.
I place a SPI.begin() in the setup function and initiate a transfer.
I leave the default SS pin as an output and high. I utilize another pin to act as the SS / CS for the slave device and I can "see" the clock on my O-scope.
Here's the problem: My MOSI output is inverted directly at the header with no external components connected, just my scope probe. So it's always "high" and drops "low" for what seems to be the data I'm shifting out.
so the process is:
my SS pin goes low.
the clk starts clocking (I can see it on the scope.)
I'm just transfering "0b10101010" out of the MOSI (I can see it, but it's inverted.)
my SS pin goes high.
throw in a delay of 1 second.
I've have had a 74HC244 connected to level shift from the 5vdc Mega2560 to the 3.3vdc minus the MISO pin. I've used a 74HC04 hex inverter minus the MISO pin and finally I tried voltage dividers minus the MISO pin.
If I directly control the pins I can get them to light LEDs in sequence with a delay (just making sure the pin isn't damaged.) but the MOSI is always inverted compared to the tutorials and what I've read. Nothing I've read so far says "the MOSI pin has to be inverted with external components."
My next step is to pour over the ATMEGA2560 datasheet in the hopes i'm just a bonehead and I'm missing something simple and hopefully someone here can educate me as to what I'm not setting up properly.
Feel free to flog and bash me if it really is something stupid I'm doing wrong or not paying attention to.
Thanks in advance,
Freezerburn