> ... how should the CS pin be configured?
OpenSPI will configure the /CS pin high. Its state before that should
be either untouched (since a processor Reset sets all pins to
InputTristate) or, if you like, you may set the pin to any state except
Low, which will likely cause the SPI device to interfere with code
execution.
Assuming you have an SPI device connected, with its /CS on pin 12, you
can test this easily:
Sub Main()
call sleep(1.0)
' call PutPin(12, bxOutputLow) ' will probably crash the
machine
here, no flashing LED
call OpenSPI(1, 0, 12) ' pin 12 set high by Open
do ' flash LED
call PutPin(25, bxOutputLow)
call sleep(0.1)
call PutPin(25, bxOutputHigh)
call sleep(0.1)
loop
End Sub
Tom
Keeping track of date and time
Started by ●October 6, 2009
Reply by ●November 3, 20092009-11-03
Reply by ●November 4, 20092009-11-04
Thanx, Tom!
My next step is to try to configure the BX to communicate with max1302
via 3-wire protocol...
1 - What should I change on my pin configuration on the BX24 side?
2 - Should I still use OpenSPI and SPICmd commands?
Reg
David M.
My next step is to try to configure the BX to communicate with max1302
via 3-wire protocol...
1 - What should I change on my pin configuration on the BX24 side?
2 - Should I still use OpenSPI and SPICmd commands?
Reg
David M.
Reply by ●November 4, 20092009-11-04
> ... 1 - What should I change on my pin configuration
on the BX24 side?
2 - Should I still use OpenSPI and SPICmd commands?
If, by "3-wire protocol" you mean SPI, if you are currently successful
with the max146, I see no reason to change anything except the data you
send to control the device, and the handling and interpretation of the
resulting data.
Tom
2 - Should I still use OpenSPI and SPICmd commands?
If, by "3-wire protocol" you mean SPI, if you are currently successful
with the max146, I see no reason to change anything except the data you
send to control the device, and the handling and interpretation of the
resulting data.
Tom
Reply by ●November 5, 20092009-11-05
But on the max1302 side I only have the following pins for communication:
SCLK, I/O and CE
What should I connect to I/O? Both MISO and MOSI? Without external
components such as diodes or resistors?
David M.
SCLK, I/O and CE
What should I connect to I/O? Both MISO and MOSI? Without external
components such as diodes or resistors?
David M.
Reply by ●November 5, 20092009-11-05
> ... SCLK, I/O and CE...
Are we looking at the same part?
The Maxim Max1302 shows Din, Dout, SClk, and /CS.
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4746
Tom
Are we looking at the same part?
The Maxim Max1302 shows Din, Dout, SClk, and /CS.
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4746
Tom
Reply by ●November 5, 20092009-11-05
No, sorry, the CORRECT part number is maxim's DS1302:
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2685
David M.
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2685
David M.
Reply by ●November 5, 20092009-11-05
> ... DS1302...
Ah; you did say 3-wire and, you're right, that's not an SPI interface
device. You'd have better success, I think, using ShiftIn() and
ShiftOut() with it.
Somewhere up the thread, you were talking about using a DS1305, which is
an SPI RTC.
Tom
Ah; you did say 3-wire and, you're right, that's not an SPI interface
device. You'd have better success, I think, using ShiftIn() and
ShiftOut() with it.
Somewhere up the thread, you were talking about using a DS1305, which is
an SPI RTC.
Tom
Reply by ●November 5, 20092009-11-05
Unfortunatly my DS1305 did not yet arrive and so I was trying to solve
my problem with a DS1302...
What is opinion?
1- Is it much hard work than with a SPI interface?
2 - DS1302 is LSB first whereas Shiftout command is MSB first... I would
need to do some bitwise operations, right?
3 - I would need to set the CE pin manually, right?
Thanks again for all your help
David M.
my problem with a DS1302...
What is opinion?
1- Is it much hard work than with a SPI interface?
2 - DS1302 is LSB first whereas Shiftout command is MSB first... I would
need to do some bitwise operations, right?
3 - I would need to set the CE pin manually, right?
Thanks again for all your help
David M.
Reply by ●November 5, 20092009-11-05
Yes, you'll need to control CE via PutPin(). On a quick read of the
DS1302 single-byte read/write specs, it looks like you need to raise CE,
then write a command byte then write a data byte for output to the
'1302, or write a command byte then read a data byte for input from the
'1302, then drop CE.
Reversing the bit order can be done in a simple loop, shifting one byte
value right while the other shifts left, or vice-versa. You might find
that, since you apparently need to loop through the byte anyway, it
might be easier to just output (or input) the bit using PutPin() then,
rather than wait for a complete reversed byte to use ShiftOut() or
ShiftIn(); if you do that you'll also need to generate the clock pulse
with a pair of PutPin(). The data rate would be slower that way but, if
you want to, you can speed it up later once you have something working.
Tom
DS1302 single-byte read/write specs, it looks like you need to raise CE,
then write a command byte then write a data byte for output to the
'1302, or write a command byte then read a data byte for input from the
'1302, then drop CE.
Reversing the bit order can be done in a simple loop, shifting one byte
value right while the other shifts left, or vice-versa. You might find
that, since you apparently need to loop through the byte anyway, it
might be easier to just output (or input) the bit using PutPin() then,
rather than wait for a complete reversed byte to use ShiftOut() or
ShiftIn(); if you do that you'll also need to generate the clock pulse
with a pair of PutPin(). The data rate would be slower that way but, if
you want to, you can speed it up later once you have something working.
Tom
Reply by ●November 5, 20092009-11-05