|
|
| Author |
Message |
coopecb1
Joined: 18 May 2011
Posts: 8
|
|
Posted: 27 May 2011, 22:00 PM Post subject: Hardware SPI hangs on ZX-24x |
|
|
Using software SPI works fine:
| Code: | Option TargetDevice ZX24x
Sub Main()
Dim odata(1 to 2) as Byte
Dim idata(1 to 2) as Byte
Dim SPIMode as Integer
SPIMode = 16
Call DefineSPI(9,10,11)
Call OpenSPI(1,SPIMode,12)
do
odata(1) = &HA5
odata(2) = &H77
Debug.Print "Got to here 1"
Call SPICmd(1,2,odata,0,idata)
Debug.Print "Got to here 2"
Call Sleep(0.1)
loop
End Sub |
The following hangs at SPICmd. CS goes low once and stays there:
| Code: | Option TargetDevice ZX24x
Sub Main()
Dim odata(1 to 2) as Byte
Dim idata(1 to 2) as Byte
Dim SPIMode as Integer
SPIMode = 0
Call OpenSPI(1,SPIMode,12)
do
odata(1) = &HA5
odata(2) = &H77
Debug.Print "Got to here 1"
Call SPICmd(1,2,odata,0,idata)
Debug.Print "Got to here 2"
Call Sleep(0.1)
loop
End Sub |
This is using ZBasic with the patch you sent me (3.3.1) that has the ADC fix for the 24x. |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 28 May 2011, 16:10 PM Post subject: Re: Hardware SPI hangs on ZX-24x |
|
|
| coopecb1 wrote: | | The following hangs at SPICmd. CS goes low once and stays there: | The source of the problem has been found and corrected; it only affects xmega-based ZX devices. You can download an updated partial set of ZBasic Library files via the link below. The contents of the downloaded archive should be extracted (preserving path prefixes) to the zlib subdirectory of the ZBasic installation directory. When you're finished you should find two files with today's date in the zlib\avr\lib subdirectory. Re-compiling your code should then produce the correct result.
http://www.zbasic.net/download/zlib/3.3/zlib_3-3-2_xmega.zip |
|
| Back to top |
|
 |
coopecb1
Joined: 18 May 2011
Posts: 8
|
|
Posted: 31 May 2011, 20:31 PM Post subject: |
|
|
Once again, thanks for getting to this so quickly, and on a holiday weekend at that!
I have to wonder, am I the first user of the 24x? At least for these functions? |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 31 May 2011, 21:17 PM Post subject: |
|
|
| coopecb1 wrote: | | I have to wonder, am I the first user of the 24x? | Of course, not everyone uses the same set of System Library routines. As much as we try to test thoroughly, we don't test every possible program so problems are bound to arise. We don't promise to deliver perfect code (no one can, of course). We do, however, endeavor to correct problems that do arise as quickly as possible. |
|
| Back to top |
|
 |
|