I've read through this forum and the recommended sections of the docs but I'm still unclear on a few things - possibly because they are over my head.
1. Is SPICmd the only way to handle extenal SPI EEPROM? With the ZX-40a, I'm using the ST M95512 (for which there are now three major suppliers with no minimum order). Being able to free all 64KB for user data is attractive for my application. Given the reduced life of flash, I would think that there would be limited use for PutProgMen/GetProgMem on the native mode devices. Is there any possibility PutProgMen/GetProgMem can be used with external EEPROM?
2. Is it possible to create linkable .obj files using ZBasic? I want to make my application open source (including Windows, Linux & Mac interfaces) but there are a couple of devices it supports where I'm restrained by a very restrictive NDA. I'd like to be able to hide this code while making the rest open, still allowing users to modify the ZBasic source for the open part if desired, which. I assume, would require distributing the .obj file for the restricted code. It would be handy for those of us who aren't fluent in C if we could do this in ZBasic.
3. There's a lot of C code to do things like USB and TCP/IP on AVR chips. Will we be able to make use of some of this?
disorganized native mode questions
Re: disorganized native mode questions
Yes. An external SPI EEPROM is no different than any other external SPI device.dlh wrote:1. Is SPICmd the only way to handle extenal SPI EEPROM?
Inasmuch as the external EEPROM isn't Program Memory, this would seem to be inappropriate. A better course would be to create similar routines specifically for external SPI EEPROM which would likely utilize SPICmd() for device communication but they could also interact directly with the SPI control/data registers.dlh wrote:Is there any possibility PutProgMem/GetProgMem can be used with external EEPROM?
There is no way to instruct the ZBasic compiler to do so. That said, it can be done by someone that understands avr-gcc and the significance of the ZBasic --keep-files options. It would probably make more sense, by the way, to distribute an object library. This is on the topic list for native mode application notes.dlh wrote:2. Is it possible to create linkable .obj files using ZBasic?
Yes. You can specify C and assembly language source code files (.c and .S) as part of your project. The ZBasic compiler doesn't process these files directly but does add their names to the makefile that gets generated to perform the backend build. Similarly, object files and object libraries (.o and .a files) can be part of a project and are likewise added to the makefile.dlh wrote:3. There's a lot of C code to do things like USB and TCP/IP on AVR chips. Will we be able to make use of some of this?
- Don Kinzer
Re: disorganized native mode questions
What are the three suppliers? I see that Nu Horizons has the SO8 package for $1.64 in 1-99 quantities, slightly less for the TSSOP-8 package.dlh wrote:I'm using the ST M95512 (for which there are now three major suppliers with no minimum order).
- Don Kinzer
Re: disorganized native mode questions
I posted a set of such routines that will work for either native mode or VM devices. See http://www.zbasic.net/forum/post-4894.html#4894dkinzer wrote:create similar routines specifically for external SPI EEPROM.
- Don Kinzer
I've always used PutEEPROM/GetEEPROM going back to the BX-24. Can you provide a speed comparison between those routines and your SPICmd based routines for VM devices and compare the older routines on a VM device with the SPICmd routines on a native device?
BTW, thanks for the routines. I'm sure many will find them helpful.
BTW, thanks for the routines. I'm sure many will find them helpful.
Using the test code below, writing 100 bytes of data took 5.8mS on a ZX-24a and 4.5mS on a ZX-24n. In contrast, the same test using the SPI EEPROM routines to write to an off-board AT25256A on the ZX-24a took 5.2mS.dlh wrote:Can you provide a speed comparison.
Code: Select all
Const chan as Byte = 1
Const addr as UnsignedInteger = 10000
' uncomment this to use the SPI EEPROM routines
#define USE_SPI_EEPROM
#if Option.TargetCode = "Native"
Const pin as Byte = B.4
#else
Const pin as Byte = 5
#endif
Sub Main()
Dim i as Integer
Dim tick as Long
#ifdef USE_SPI_EEPROM
Call InitSPI_EEPROM(chan, pin)
#endif
tick = Register.RTCTick
For i = 1 to 100
#ifdef USE_SPI_EEPROM
Call WriteSPI_EEPROM(chan, addr, tick.DataAddress, 100)
#else
Call PutProgMem(CLng(addr), tick, 100)
#endif
Next i
tick = Register.RTCTick - tick
Debug.Print "Elapsed time is "; CStr(tick); " ticks."
End Sub
- Don Kinzer