PropGCC and C3
Rsadeika
Posts: 3,837
in Propeller 1
I have been making some headway with my C3 experiments, now I have come to problem. I want to implement the SD driver and use FDSerial, this is what I am using:
/* c3xsensor.c */
#include "propeller.h"
#include <sys/rtc.h>
#include "misc.h"
#include "sht11.h"
#include <sys/sd.h>
#include <dirent.h>
#define BUFFERLEN 10
FILE *term;
extern _Driver _FDSerialDriver;
extern _Driver _FileDriver;
_Driver *_driverlist[] = {
&_FDSerialDriver,
&_FileDriver,
NULL
};
*term = fdserial_open("FDSER",31,30,0,9600);
The serial part is not working, I get an error - incompatible types 'FILE and type int'. I have not tried the SD part yet. For the SD what is now the correct way for doing this with the C3, does it still need mount()? Again, this all command line approach, no SimpleIDE.
I had to rework Sensirion sht11 code to make it work with a command line approach, at least it is working as expected.
Ray
/* c3xsensor.c */
#include "propeller.h"
#include <sys/rtc.h>
#include "misc.h"
#include "sht11.h"
#include <sys/sd.h>
#include <dirent.h>
#define BUFFERLEN 10
FILE *term;
extern _Driver _FDSerialDriver;
extern _Driver _FileDriver;
_Driver *_driverlist[] = {
&_FDSerialDriver,
&_FileDriver,
NULL
};
*term = fdserial_open("FDSER",31,30,0,9600);
The serial part is not working, I get an error - incompatible types 'FILE and type int'. I have not tried the SD part yet. For the SD what is now the correct way for doing this with the C3, does it still need mount()? Again, this all command line approach, no SimpleIDE.
I had to rework Sensirion sht11 code to make it work with a command line approach, at least it is working as expected.
Ray
Comments
That has been sorted out as of a couple of years ago, I do not remember if you still need to use a mount() function. If I get desperate than I will provide a mount(), but I would like to get the latest info on this.
The problem I having now is getting a serial to work, so far I have had it compile and then lock up my program after load, or it does not recognize fdserial when compiled.
Ray
term = fdserial_open("FDSER",31,30,0,9600);
However, my guess is it returns and integer and you'd need to do something like this:
int fd;fd = fdserial_open("FDSER",31,30,0,9600);
Ray
fdserial * fdserial_open (int rxpin, int txpin, int mode, int baudrate);You would need to include simpletools.h and link to the simple libraries.You can also open a serial port using fopen. Check the PropGCC documentation on how to do that.EDIT: The documentation for fopen is at http://propgcc.googlecode.com/hg/doc/Library.html#fopen .
fdserial * fdserial_open (int rxpin, int txpin, int mode, int baudrate);
You would need to include simpletools.h and link to the simple libraries.
You can also open a serial port using fopen. Check the PropGCC documentation on how to do that.
EDIT: The documentation for fopen is at http://propgcc.googlecode.com/hg/doc/Library.html#fopen .
Ah, I guess the "fd" stands for "full duplex" rather than "file descriptor". My mistake. I guess I should stop trying to help out with PropGCC questions because I'm not thaf familiar with the simple libraries and they seem to be all anyone is using these days.
fdserial * fdserial_open (int rxpin, int txpin, int mode, int baudrate);
You would need to include simpletools.h and link to the simple libraries.
You can also open a serial port using fopen. Check the PropGCC documentation on how to do that.
EDIT: The documentation for fopen is at http://propgcc.googlecode.com/hg/doc/Library.html#fopen .
Ah, I guess the "fd" stands for "full duplex" rather than "file descriptor". My mistake. I guess I should stop trying to help out with PropGCC questions because I'm not thaf familiar with the simple libraries and they seem to be all anyone is using these days.
The simple libraries are useful, but it does bother me that there are some functions that duplicate the standard functions, and aren't really necessary. One example is the print function, which is basically the same as printf.
Ray, as far as mount is concerned, I believe it needs to be called explicitly unless you are running the the XMMC model from an SD card. BTW, mount is a simple tools function. However, I'm not sure it will work with the C3 card since mount only allows specifying DO, DI, CLK and CS. I think you need to call dfs_mount for the C3 card. You can look at the filetest demo to see how dfs_mount is called.
The SD card thing is very confusing, at the Learn site, their example shows the use of a mount() function, but that is heavy on Activity board functionality. I remember at one point, back a couple of years, their was a discussion about not needing to use the mount() function, this seems to bouncing all over the place.
I am also noticing that if you will be using a specific type of board, you almost need to have a board specific driver file. So maybe I need to start thinking about that while my support files are still manageable. I have to be very careful, this could turn out to be a bigger project that I want to get involved in.
Ray