my DNAxxx program
Rsadeika
Posts: 3,837
I am trying to create a DNA board specific program. I created a separate file, dnsSD.c, that will hold mount() and List(), to start with. The main file is DNAxxx.c which is a UI that will call the specific functions, in this case mount(), and List(). So far the project compiles without errors, but when I request List(), nothing happens, the program just hangs. So first you use mountSD to mount() which seems to work, then ll to List() which just hangs.
I would appreciate if somebody would look at this and see what I am doing wrong.
Thanks
Ray
I would appreciate if somebody would look at this and see what I am doing wrong.
Thanks
Ray
Comments
Ray
Recommended reading.
https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxwcm9wZWxsZXJnY2N8Z3g6NWJlNzM0NzBlODZiYzJkMQ&pli=1
Read sections 5 through 7. The simplest way to add SDcard is mentioned in the very last paragraph of section 7.
For example add these to your config file:
Martin offers these pages for DNA.
http://mghdesigns.com/wiki/dna:start
The dna.cfg file seems complicated, but it is just a version that uses the loader's expression parser.
http://mghdesigns.com/wiki/dna:dna.cfg
Ray
Ray
Now I am thinking about including some code for using the RTC, not sure how I am going to have it appear in the UI. At the MGH Designs web site they refer you to Roy Eltham's Spin driver for the Seiko RTC, I looked at the code, and I am not sure how that will work for me. Are their any examples of I2C, and how to use it with C? I guess if look at some good examples of, how to use I2C code, maybe I can figure it out. Any ideas will be appreciated.
Ray
Ray
testI2C.c:19:19: error: 'I2C_RETRIES' undeclared (first use in this function)
Where is I2C_RETRIES? I guess it is not in <i2c.h>? Slowly, but ...
Ray
Ray
Basically, in the UI you have these commands: help, time, date, day, month, year, quit. As mentioned the time command does not work. You have to set the DateTime manually in the program with the rtc1_Setdatetime() command which at the moment contains some irrelevant data. I just wanted to test out the RTC part of the DNA board to see if it really works.
Once the time clock part gets fixed then I will probably incorporate this into the DNAxxx(filetest) program.
Ray
You should call rtc1_Update() somewhere in your while loop such as after gets(buffer). Otherwise the time and date will not change when read by your UI.
Another thing I noticed is that basic_i2c_driver.c relies heavily on the code running slowly. CMM "apparently" works, but LMM does not. By apparently, I mean that it's more or less an accident that it works and a higher clock rate or other performance improvements might make the driver fail.
//Set date time: Month,day,year,DOW,min,seconds
//DOW - 0-Sun,1-Mon,2-tue,3-Wed,4-Thur,5-Fri,6-Sat
rtc1_Setdatetime(9,13,12,5,12,51);
Once I put in the correct Setdatetime() values, the program runs as expected.
For a more ambitious project I was thinking, use the RTC lib, in a thread, and have it update from the hardware RTC. Then of course you have to figure where you would update the hardware RTC from, and of course if someone using a different RTC ...
Now I have to figure out how I will incorporate the RTC program into the DNAxxx(filetest) program.
<edit> I also noticed that if you use printc.c program, it screws the output to the screen. Also, if you check the Simple printf, that also screws up the output to the screen. <edit>
Ray
As for RTC, you could try something like below to use the built-in unix time facilities.
This is obviously not for the DNA board, I use it on my tiny Gamebaby LCD box, and it has a PASM driver that is accessible via GbI2C_rtc_* function calls. I call RTC_init() from the main program at startup.
I guess we have to consider what types of programs to use with the spin2cpp program; are programs that use their own i2c going to fail? What are the limtations of the spin2cpp program? Is propGCC team going to provide the drivers to support the different RTC units? If so, when will that occur? Lots of questions to be answered.
I guess I have to rethink porting the dnaRTC program to the DNAxxx(filetest) program. I will try to look at the spin2cpp converted code and see if I can make it work using existing propGCC libs, but I can see a lot of problems that I may not be able to solve. I guess what I really need is a good, full use, I2C program example, to start with. I was using bits and pieces of existing code snippets, with no positive results. Any ides would be appreciated.
Ray
The official devices to be added for propeller-gcc and timing of that is up to Parallax (beyond what we have time add).
I use a COG driver with a C wrapper for time sensitive devices like I2C. Here's my entire GameBaby code collection if you want to see what I've done. There are 5 different devices on the I2C bus handled by one PASM driver.
I'm afraid that's a source code problem that's up to the user to fix.
EDIT: Set DELAY_CYCLES to 255 if you need to run at 100 KHz.
Ray
Ray
If you have a Spinneret board it would be interesting to get your code working on that card. It also has an RTC and SD card socket.
I just burned my EEPROM with the DNA-xxx program, and I noticed the file size, in CMM mode was ~28KB, I also noticed that their is nothing in SimpleIDE to prepare and store a program on the SD card, at least not for the DNA board. I guess MGH Designs has to do some more support work for the DNA board. In the mean time is their a work around? If the DNA-xxx program grows any bigger, bigger than 32KB in CMM, I will have to store it to the SD card because it will not fit on the EEPROM.
@Dave Hein, in the Burrows version of basic_i2c_driver, he added a couple of Methods, devicePresent(), writeLocation(), readLocation(). When I added those too the pasm_i2c_driver, and ran it through the spi2cpp, the resulting code, of pasm_i2c_driver did not work correctly in the C version. Was that just a fluke, or does their have to be something else done to pasm_i2c_driver to make those Methods work?
Is their a C to C++ conversion program, just wondering what DNA-xxx would look like and run like in C++ mode?
<edit> Just a thuoght, is there any way of using filetest and storing the created files to the EEPROM instead of/or the SD card? Then at least you could possibly use the filetest program on the QuickStart board. <edit>
Ray
Ray
Generic time.h page that shows functions, etc...
http://pubs.opengroup.org/onlinepubs/7908799/xsh/time.h.html
Describes formatting parameters for strftime.
http://pubs.opengroup.org/onlinepubs/7908799/xsh/strftime.html
Here's some code from my LCD project.