Hi everyone, I'm new with Catalina, and I need help to install it.
I already unzip catalina_win32_binary.zip (and .z01) in the folder C:\Program Files\Catalina
Then, I installed codeblocks using codeblocks-8.02-setup, and I am able to open the program and create project and so on.
That is what I have done up to this moment.
My problem is that codeblock doesn't recognize that I have Cataline somewhere. What else do I have to do in order to be able to compile programs form codeblock?
I'm sorry, I know this should be a elemental question, but the instructions are not clear for me.
Please help me by providing simple steps to follow.
You're most of the way there! The remaining steps are described in the document "Getting Started with CodeBlocks" which should be in your main Catalina folder (e.g. C:\Program Files\Catalina). If it is not, you need to download and unzip the catalina_documents.zip file.
This document will guide you through the remaining Code::Blocks installation steps, and it also contains a tutorial on how to use Code::Blocks to build a Catalina program.
Let me know if you need any more assistance.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Hi RossH, thank u very much for answer. I found the instructions and I'm following them. They refer to user_sets_win32.xml, and I am supposed to copy that information in the config file inside the section:
<user_sets>
<catalina>
</catalina>
</user_sets>
However, I can't find user_sets_win32.xml, where is it?.
Both the file user_sets_win32.xml and the UserTemplates folder are contained in the zip file "C:\Catalina\codeblocks\codeblocks_win32.zip". Unzip that file into "C:\Catalina\codeblocks".
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Thanks RossH, I have finish the instalation, and I'm able to compile using catalina from codeblocks.
I would like to know where is the demo.workspace, I just can't find it.
Now I have to figure out how to compile something for the propeller and how to download the file to the propeller. What do you recommend?
Are there libraries for the propeller in codeblocks? something like init_cogs?
The demo.workspace is in the same zip file as all the other Code::Blocks stuff - just use File->Open from within Code::Blocks and go to the directory where you unzipped the codeblocks_win32.zip file. Note that this workspace expects everything to have been installed in the default location ("C:\Program Files\Catalina").
Code::Blocks is just a GUI - but Catalina contains library functions for all the Propeller operations - see the Catalina Reference manual, or look at catalina_cog.h in the include directory. If you plan to move back and forth between ICC and Catalina, there is a set of "wrapper" macros in catalina_icc.h that will simplify writing portable C code.
For loading the programs, you can use the Parallax tools, or use the Catalina Payload program - e.g from the command line, enter:
payload hello_world.binary
This should find the Propeller if it is plugged into any port (and powered on). The current version of payload only loads program into RAM - if you need to load into EEPROM, use the Parallax Propellent loader (in the next version of Catalina I have added a '-e' switch to payload to program the EEPROM).
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I have released Catalina 2.5. This release includes the source for Catalyst. Binary releases of Catalyst for various platforms are available in the Catalyst thread (here).
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Drat - I didn't think to check that before the release! Thanks for the info.
The current installation method for Code::Blocks requires you to manually edit the config file, so it may still be ok if the format of this file hasn't changed. However, the templates and demo workspaces will probably not work.
You can try it if you like, but I think you will have problems. Unless you already have some experience with Code::Blocks, you may be better off waiting until I check out the new version - if necessary I'll post a patch release.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I have verified that Catalina release 2.5 works correctly with the latest version of Code::Blocks - all I had to do was install the new Code::Blocks release (10.05) over my existing one (8.02).
However, while testing I noticed that I had not updated the example Code::Blocks workspace I include with Catalina to accomodate a few minor changes made in Release 2.5 - so a new version of the codeblocks files is attached to the first post of this thread. You don't need this file if you don't use Code::Blocks.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Just uploaded new versions of the Catalina documents and tutorials, to fix a few minor issues. The only one of any significance was a couple of references to the wrong environment variable - the document referred to CATALINA_TARGET for defining command line options when it should have said CATALINA_DEFINE (as the name implies, CATALINA_TARGET is used for specifying an alternate target directory).
Apologies for the inconvenience.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Hi RossH, I installed Catalina successfully and now I'm trying to download my programs to the propeller using the propeller tool as you recommended to me, but I have the·USB prop-stick·and I can't find it in the list of supported platforms. I find Hybrid, Hydra, Morpheus, Triblade and Demo board,·but not the USB prop-stick, which only has serial communication through USB. The main problem is that those architectures have different pin configuration, thus I'm not able to use the serial port, for example. · Is it possible to drive the USB prop-stick by downloading programs from propeller tool? Remember I'm using Catalina for writing C programs. · Thank in advance.
What you are trying to is certainly possible. But I'm not sure exactly what the problem is. Is it that you cannot download any Catalina program to the PropStick? Or is it that you can dowload a Catalina program but it won't run?
If the problem is the former, then for normal (i.e. LMM) Catalina programs you can use any of the usual download tools (such as the Propeller Tool or Propellent). You can also use Payload - Payload only needs to know the platform when downloading XMM programs (because of the different XMM implementations).
If the problem is the latter, then you may need to tweak the Catalina pin and clock definitions for your platform. The easiest way to do this is to start out by modifying one that is simple and probably fairly close to what you need, such as the DEMO platform - have a look in the file Catalina_Common_Input.spin (which is in the target\input directory) and look at the section surrounded by #elseifdef DEMO... #elseifdef DRACBLADE:
...
#elseifdef DEMO
'===============================================================================
'
' Demo Board General definitions:
'
'===============================================================================
KBD_PIN = 26 ' BASE PIN (Demo)
MOUSE_PIN = 24 ' BASE PIN (Demo)
TV_PIN = 12 ' BASE PIN (Demo)
VGA_PIN = 16 ' BASE PIN (Demo)
SD_DO_PIN = -1 ' Demo has no SD Card
SD_CLK_PIN = -1 ' Demo has no SD Card
SD_DI_PIN = -1 ' Demo has no SD Card
SD_CS_PIN = -1 ' Demo has no SD Card
I2C_PIN = 28 ' I2C Boot EEPROM SCL Pin
I2C_DEV = $A0 ' I2C Boot EEPROM Device Address
SI_PIN = 31 ' PIN (Demo)
SO_PIN = 30 ' PIN (Demo)
'
' Demo Board Clock definitions:
'
CLOCKMODE = xtal1 + pll16x ' (Demo)
XTALFREQ = 5_000_000 ' (Demo)
CLOCKFREQ = 80_000_000 ' (Demo) Nominal clock frequency (required by some drivers)
'
' Demo Board Loader and InterProp Comms definitions:
'
SIO_BAUD = 115200 ' Baud rate to use for all interprop comms
SIO_LOAD_MODE = %0000 ' Demo has only one CPU - this is for serial loading
SIO_COMM_MODE = %0000 ' Demo has only one CPU - this is for serial loading
TX_PIN = -1 ' Demo has only one CPU
RX_PIN = -1 ' Demo has only one CPU
'
' Demo Board XMM Base Address:
'
XMM_BASE_ADDRESS = -1 ' Demo board has no XMM
'
' Demo Board BlackCat debug pins (SI/SO pins)
'
BLACKCAT_RXPIN = SI_PIN ' Rx pin to use for BlackCat comms
BLACKCAT_TXPIN = SO_PIN ' Tx pin to use for BlackCat comms
BLACKCAT_MODE = %0000 ' SIO mode to use for BlackCat comms
'
#elseifdef DRACBLADE
...
I don't know the clock frequency or pinouts of the PropStick but if it is 5Mhz and uses pins 30 and 31 for serial comms, then compiling programs for the DEMO platform but with the PC option for display and keyboard (and no mouse) will not need any of the other pins. So if you compile a program with a command like the following:
catalina -lc -D DEMO -D PC -D NO_MOUSE hello_world.c
Then the result should also work on your platform.
When you have this working, I would generally recommend you add a new symbol for the platform (e.g. PROPSTICK) - but note that you will also have to add this to each of the target files you want to use (such as lmm_default_Input.spin). In each case, just copy and modify an existing entry.
Let me know how you go.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I am a new propeller user and I have Catalina. I have managed to do really simple tasks such a toggling a pin and stuffs like that. However I can't send anything through serial interface using any of the stdio.h library functions such as printf() and putchar(). I am not being able to see the "Hello world" message that should appear when you run hello_wolrd.c from the Catalina's demos directory
I have the Propeller-Stick by the way, and in building options I have the following:
variant =
model = 0
platform = DEMO (Because this platform has the same crystal and pll configuration as the Prop-stick)
memsize = 32k
And this is the simple program am loading into the prop
#include <stdio.h>
void main () {
while (1)
{
putchar(0xFFFF);
}
}
Is there any additional serial configuration that I should do, or it is just enough to include the stdio.h library? or maybe it is a problem with the plaform?
Are you telling Catalina to use a serial I/O driver for stdin/stdout? You can do this by compiling your program with the PC option.
On the command line you would add -D PC to your catalina command. In Code::Blocks you would add -D PC in the "Other link options" pane of the "Linker options" tab in the Project->Build Options. Be sure to do this at the project level. See the document "Getting Started with CodeBlocks" for more details and examples.
If you are already doing this, the problem may be that the "hello world" message is being sent before you can even start your PC terminal emulator. You can either put the program in EEPROM (so you can start it while the terminal emulator is running) or put in a loop, or wait for a keystroke. For example:
The last thing is that your putchar(0xFFFF) is probably not going to do what you expect. First of all putchar converts its argument to a char, so putchar(0xFFFF) is the same as putchar(0xFF) - and what you will actually see will depend on what your particular terminal emulator does when it gets a 0xFF character - most likely you will just see nothing.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Thank you Ross, I had to add that -D PC line as you recommended me...
A quick question, how can I change the serial Baud Rate ? is it in the Catalina_Common_Input file? because sending data through serial is being the bottle-neck of my project, which is the maximun Baud Rate I could use?
The BAUDRATE setting in the Catalina_Common.spin file is only used for loading and inter-prop comms. The baud rate used by the various PC drivers (screen, keyboard, mouse) is set in each of the drivers themselves. You will need to change it in each of the following files in Catalina\target - search for BAUDRATE:
Catalina_PC_Keyboard
Catalina_PC_Mouse
Catalina_PC_Text
I'm not sure what the maximum baud rate is. Others have reported Mbit/s performance - but that was with specially written drivers, not the ones I use. It also depends on whether you are using an RS232 or a USB port, and also on the cable you use, and the Propeller board itself. I stick to 115200 because it works in every instance. I'd suggest you try increasing it step by step, find out where it fails, and then step it down a bit.
Let me know how it goes.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Thank you very much, that was exactly what I was looking for [noparse]:)[/noparse] Right now I am facing another challenge related to the serial port. The thing is that when I change the baudrate I can see on the oscilloscope how the bits change at the frequency I specify (ex. If I set BAUDRATE = 1_000_000 then I see the bitstream changing at 1 us ) However the time between the transmission of two chars is not constant with the BAUDRATE and surprisingly increases as the BAUDRATE increases creating a limit of 83 us for sending one char and then another... I am thinking it is a limitation of the serial driver but I haven't figured it out yet, maybe you've hear something similar before
That's strange - I just a quick look at the drivers and HMI code, and I can't see any reason they would behave like that. These drivers were written by Andy Schenk for use with PropTerminal, and are quite straightforward.
The issue may be in the 'putchar' library code. Try the following instead:
It reduces the time limit from 83 us to approximately 50us but has the same weird behavior (increasing the BAUDRATE decreases the bitstream transmission time but increases the idle time between char's transmission so the total time is constant to 50 us )
I'll keep trying to find a way, however your help has been invaluable (Right now the performance I am getting is acceptable for my project, much better than before)
On the other hand, I another quick question: how can insert Propeller Assembly code using C programs compiled with Catalina?
I tried the old asm{ <code>} and asm("<code>"); but none of them worked [noparse]:([/noparse]
Thanks again Ross,
Damineitor
PS> I think I'll keep asking questions until you stop answering (won't judge you when that time come hehe!) I just can't help it, your advises have been very useful
Hey Ross, I also wanted to ask you about a problem I am having with the _coginit() function. I loaded the text_coginit function and it didn't work and I made my own _coginit() test program, which was toggling two leds (one in one cog and one in another)
toggle1 and toggle2 are endless loops. The program never reaches toggle2(), it is like instead of initializing a new cog it runs toggle1() in the main's cog...
No worry about the questions. There is no "asm" statement in Catalina, but it is fairly easy to write library routines in assembler - for some examples, see the cog functions in the library source code (in source\lib\catalina). Note that you have to avoid some instructions that are not supported because the code is being executed using LMM - see the Catalina Reference Manual for more details.
I'll try and have a look at both issues later today. There may be nothing I can do in the short term about the serial comms one, but the coginit function should work.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I just retested the _coginit function and it works correctly - I tested it on a Hydra, with 2 cogs toggling a led while the main loop prints stuff on the TV output.
Either your "toogle1" is not a valid PASM program, or the value of this variable has not been divided by 4 (it is a LONG address rather than a BYTE address).
I tried your code and it didn't work, I am thinking maybe it is about that PASM. I noticed that in the example you provide with Catalina the function you are going to run in the new cog is written in numbers, like a processed assembly... However I am not quite sure what PASM is (Processed Assembly???) and I am going to look into it on the catalina tutorials. In the meanwhile I am going to post the code here so you can take a look at your convenience
unsigned mask0 = 0x00000001; // bit 1
unsigned mask1 = 0x00000002;
unsigned on0 = 0x00000001;
unsigned on1 = 0x00000002;
unsigned off = 0x00000000;
long data[noparse]/noparse = {1, 2, 3, 4}; // this data is not used - it's just an example
void main(void)
{
_dira(mask0, mask0); // The bits are set as outputs
_dira(mask1, mask1); //
// it is not a problem about the port A configuration because changing swaping toggle0 and toggle1 function makes pin 1 to oscilate while pin 0 is dead still
_coginit((int)data>>2, (int)toggle0>>2 , ANY_COG);
toggle1();
}
int toggle0(void)
{
while(1)
{
_outa(mask0,off);
_outa(mask0,on0);
}
return(1);
}
int toggle1(void)
{
while(1)
{
_outa(mask1,off);
_outa(mask1,on1);
}
return(1);
}
Yes, the problem is that Catalina's _coginit function is a copy of the PASM equivalent, not the SPIN version. It only accepts a PASM program. It cannot accept C code since executing this type of code requires that the cog be running the LMM kernel.
I intend adding the ability to launch a new LMM kernel to a future version of Catalina. This would allow you to launch a C program in another cog.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Ok Ross, I'll be very happy (and grateful) when you release the new version. Till then I'll try to write the PSAM code, but I wanted to ask you if is there a way to write the code with the name of the instructions (like ANDN) insted of their hex equivalent?
Sorry, there is no easy way at present. I use homespun to get a listing and take the compiled version from that - or you could use bstc. Or you can use any hex editor to pull the section out of a compiled binary file. Just remember that if you are representing it as longs (as shown in my example, and in your post) that this may require you to reverse the byte ordering. Try compiling this example in SPIN, and then compare it to the version in your post and you will see what I mean:
CON
LED_PIN = 1
_clkmode = xtal1 + pll8x
_xinfreq = 10_000_000
_stack = 20
pub start
cognew (@entry, 0)
DAT
org 0
entry
or dira, #LED_PIN
andn outa, #LED_PIN
mov count,cnt
add count,increment
loop
waitcnt count, increment
xor outa, #LED_PIN
jmp #loop
count long 0
increment long 100000000
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Damineitor said...
Ok Ross, I'll be very happy (and grateful) when you release the new version. Till then I'll try to write the PSAM code, but I wanted to ask you if is there a way to write the code with the name of the instructions (like ANDN) insted of their hex equivalent?
Below is a link to a windows application that will convert a spin .binary file DAT section to a C ASCII-HEX array.
Write your PASM in a spin file (just one dat section please), and create a .binary, then run spinc on it.
The output should be a nicely formatted C array. Either it works or it doesn't ... that's all I can do for you.
Comments
I already unzip catalina_win32_binary.zip (and .z01) in the folder C:\Program Files\Catalina
Then, I installed codeblocks using codeblocks-8.02-setup, and I am able to open the program and create project and so on.
That is what I have done up to this moment.
My problem is that codeblock doesn't recognize that I have Cataline somewhere. What else do I have to do in order to be able to compile programs form codeblock?
I'm sorry, I know this should be a elemental question, but the instructions are not clear for me.
Please help me by providing simple steps to follow.
I'm using win vista 32bits.
Thank u in advance.
You're most of the way there! The remaining steps are described in the document "Getting Started with CodeBlocks" which should be in your main Catalina folder (e.g. C:\Program Files\Catalina). If it is not, you need to download and unzip the catalina_documents.zip file.
This document will guide you through the remaining Code::Blocks installation steps, and it also contains a tutorial on how to use Code::Blocks to build a Catalina program.
Let me know if you need any more assistance.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
<user_sets>
<catalina>
</catalina>
</user_sets>
However, I can't find user_sets_win32.xml, where is it?.
Thanks!
Oh!!! I found both things!
Thanks again
Both the file user_sets_win32.xml and the UserTemplates folder are contained in the zip file "C:\Catalina\codeblocks\codeblocks_win32.zip". Unzip that file into "C:\Catalina\codeblocks".
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I would like to know where is the demo.workspace, I just can't find it.
Now I have to figure out how to compile something for the propeller and how to download the file to the propeller. What do you recommend?
Are there libraries for the propeller in codeblocks? something like init_cogs?
Regards.
The demo.workspace is in the same zip file as all the other Code::Blocks stuff - just use File->Open from within Code::Blocks and go to the directory where you unzipped the codeblocks_win32.zip file. Note that this workspace expects everything to have been installed in the default location ("C:\Program Files\Catalina").
Code::Blocks is just a GUI - but Catalina contains library functions for all the Propeller operations - see the Catalina Reference manual, or look at catalina_cog.h in the include directory. If you plan to move back and forth between ICC and Catalina, there is a set of "wrapper" macros in catalina_icc.h that will simplify writing portable C code.
For loading the programs, you can use the Parallax tools, or use the Catalina Payload program - e.g from the command line, enter:
This should find the Propeller if it is plugged into any port (and powered on). The current version of payload only loads program into RAM - if you need to load into EEPROM, use the Parallax Propellent loader (in the next version of Catalina I have added a '-e' switch to payload to program the EEPROM).
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Post Edited (RossH) : 5/30/2010 3:29:43 AM GMT
I have released Catalina 2.5. This release includes the source for Catalyst. Binary releases of Catalyst for various platforms are available in the Catalyst thread (here).
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Thanks
Bill M.
Drat - I didn't think to check that before the release! Thanks for the info.
The current installation method for Code::Blocks requires you to manually edit the config file, so it may still be ok if the format of this file hasn't changed. However, the templates and demo workspaces will probably not work.
You can try it if you like, but I think you will have problems. Unless you already have some experience with Code::Blocks, you may be better off waiting until I check out the new version - if necessary I'll post a patch release.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I have verified that Catalina release 2.5 works correctly with the latest version of Code::Blocks - all I had to do was install the new Code::Blocks release (10.05) over my existing one (8.02).
However, while testing I noticed that I had not updated the example Code::Blocks workspace I include with Catalina to accomodate a few minor changes made in Release 2.5 - so a new version of the codeblocks files is attached to the first post of this thread. You don't need this file if you don't use Code::Blocks.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Just uploaded new versions of the Catalina documents and tutorials, to fix a few minor issues. The only one of any significance was a couple of references to the wrong environment variable - the document referred to CATALINA_TARGET for defining command line options when it should have said CATALINA_DEFINE (as the name implies, CATALINA_TARGET is used for specifying an alternate target directory).
Apologies for the inconvenience.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I installed Catalina successfully and now I'm trying to download my programs to the propeller using the propeller tool as you recommended to me, but I have the·USB prop-stick·and I can't find it in the list of supported platforms. I find Hybrid, Hydra, Morpheus, Triblade and Demo board,·but not the USB prop-stick, which only has serial communication through USB. The main problem is that those architectures have different pin configuration, thus I'm not able to use the serial port, for example.
·
Is it possible to drive the USB prop-stick by downloading programs from propeller tool? Remember I'm using Catalina for writing C programs.
·
Thank in advance.
What you are trying to is certainly possible. But I'm not sure exactly what the problem is. Is it that you cannot download any Catalina program to the PropStick? Or is it that you can dowload a Catalina program but it won't run?
If the problem is the former, then for normal (i.e. LMM) Catalina programs you can use any of the usual download tools (such as the Propeller Tool or Propellent). You can also use Payload - Payload only needs to know the platform when downloading XMM programs (because of the different XMM implementations).
If the problem is the latter, then you may need to tweak the Catalina pin and clock definitions for your platform. The easiest way to do this is to start out by modifying one that is simple and probably fairly close to what you need, such as the DEMO platform - have a look in the file Catalina_Common_Input.spin (which is in the target\input directory) and look at the section surrounded by #elseifdef DEMO... #elseifdef DRACBLADE:
I don't know the clock frequency or pinouts of the PropStick but if it is 5Mhz and uses pins 30 and 31 for serial comms, then compiling programs for the DEMO platform but with the PC option for display and keyboard (and no mouse) will not need any of the other pins. So if you compile a program with a command like the following:
Then the result should also work on your platform.
When you have this working, I would generally recommend you add a new symbol for the platform (e.g. PROPSTICK) - but note that you will also have to add this to each of the target files you want to use (such as lmm_default_Input.spin). In each case, just copy and modify an existing entry.
Let me know how you go.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I am a new propeller user and I have Catalina. I have managed to do really simple tasks such a toggling a pin and stuffs like that. However I can't send anything through serial interface using any of the stdio.h library functions such as printf() and putchar(). I am not being able to see the "Hello world" message that should appear when you run hello_wolrd.c from the Catalina's demos directory
I have the Propeller-Stick by the way, and in building options I have the following:
variant =
model = 0
platform = DEMO (Because this platform has the same crystal and pll configuration as the Prop-stick)
memsize = 32k
And this is the simple program am loading into the prop
#include <stdio.h>
void main () {
while (1)
{
putchar(0xFFFF);
}
}
Is there any additional serial configuration that I should do, or it is just enough to include the stdio.h library? or maybe it is a problem with the plaform?
I look forward to reading any suggestion guys,
Are you telling Catalina to use a serial I/O driver for stdin/stdout? You can do this by compiling your program with the PC option.
On the command line you would add -D PC to your catalina command. In Code::Blocks you would add -D PC in the "Other link options" pane of the "Linker options" tab in the Project->Build Options. Be sure to do this at the project level. See the document "Getting Started with CodeBlocks" for more details and examples.
If you are already doing this, the problem may be that the "hello world" message is being sent before you can even start your PC terminal emulator. You can either put the program in EEPROM (so you can start it while the terminal emulator is running) or put in a loop, or wait for a keystroke. For example:
The last thing is that your putchar(0xFFFF) is probably not going to do what you expect. First of all putchar converts its argument to a char, so putchar(0xFFFF) is the same as putchar(0xFF) - and what you will actually see will depend on what your particular terminal emulator does when it gets a 0xFF character - most likely you will just see nothing.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
A quick question, how can I change the serial Baud Rate ? is it in the Catalina_Common_Input file? because sending data through serial is being the bottle-neck of my project, which is the maximun Baud Rate I could use?
Damineitor
Glad you got it working.
The BAUDRATE setting in the Catalina_Common.spin file is only used for loading and inter-prop comms. The baud rate used by the various PC drivers (screen, keyboard, mouse) is set in each of the drivers themselves. You will need to change it in each of the following files in Catalina\target - search for BAUDRATE:
- Catalina_PC_Keyboard
- Catalina_PC_Mouse
- Catalina_PC_Text
I'm not sure what the maximum baud rate is. Others have reported Mbit/s performance - but that was with specially written drivers, not the ones I use. It also depends on whether you are using an RS232 or a USB port, and also on the cable you use, and the Propeller board itself. I stick to 115200 because it works in every instance. I'd suggest you try increasing it step by step, find out where it fails, and then step it down a bit.Let me know how it goes.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Thank you very much, that was exactly what I was looking for [noparse]:)[/noparse] Right now I am facing another challenge related to the serial port. The thing is that when I change the baudrate I can see on the oscilloscope how the bits change at the frequency I specify (ex. If I set BAUDRATE = 1_000_000 then I see the bitstream changing at 1 us ) However the time between the transmission of two chars is not constant with the BAUDRATE and surprisingly increases as the BAUDRATE increases creating a limit of 83 us for sending one char and then another... I am thinking it is a limitation of the serial driver but I haven't figured it out yet, maybe you've hear something similar before
Here is the code I am using:
#include <stdio.h>
void main(void)
{
while(1)
{
putchar(0x00);
}
}
Hope to hear from you soon,
Damineitor
That's strange - I just a quick look at the drivers and HMI code, and I can't see any reason they would behave like that. These drivers were written by Andy Schenk for use with PropTerminal, and are quite straightforward.
The issue may be in the 'putchar' library code. Try the following instead:
Let me know if this makes any difference.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
It reduces the time limit from 83 us to approximately 50us but has the same weird behavior (increasing the BAUDRATE decreases the bitstream transmission time but increases the idle time between char's transmission so the total time is constant to 50 us )
I'll keep trying to find a way, however your help has been invaluable (Right now the performance I am getting is acceptable for my project, much better than before)
On the other hand, I another quick question: how can insert Propeller Assembly code using C programs compiled with Catalina?
I tried the old asm{ <code>} and asm("<code>"); but none of them worked [noparse]:([/noparse]
Thanks again Ross,
Damineitor
PS> I think I'll keep asking questions until you stop answering (won't judge you when that time come hehe!) I just can't help it, your advises have been very useful
_coginit((int)data, (int)toggle1 , ANY_COG);
toggle2();
toggle1 and toggle2 are endless loops. The program never reaches toggle2(), it is like instead of initializing a new cog it runs toggle1() in the main's cog...
Thank you again...
Damian
No worry about the questions. There is no "asm" statement in Catalina, but it is fairly easy to write library routines in assembler - for some examples, see the cog functions in the library source code (in source\lib\catalina). Note that you have to avoid some instructions that are not supported because the code is being executed using LMM - see the Catalina Reference Manual for more details.
I'll try and have a look at both issues later today. There may be nothing I can do in the short term about the serial comms one, but the coginit function should work.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I just retested the _coginit function and it works correctly - I tested it on a Hydra, with 2 cogs toggling a led while the main loop prints stuff on the TV output.
Either your "toogle1" is not a valid PASM program, or the value of this variable has not been divided by 4 (it is a LONG address rather than a BYTE address).
Try:
If you post your actual program, I'll have a look at it.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
I tried your code and it didn't work, I am thinking maybe it is about that PASM. I noticed that in the example you provide with Catalina the function you are going to run in the new cog is written in numbers, like a processed assembly... However I am not quite sure what PASM is (Processed Assembly???) and I am going to look into it on the catalina tutorials. In the meanwhile I am going to post the code here so you can take a look at your convenience
#include <stdio.h>
#include <catalina_hmi.h>
#include <catalina_cog.h>
int toggle0(void);
int toggle1(void);
unsigned mask0 = 0x00000001; // bit 1
unsigned mask1 = 0x00000002;
unsigned on0 = 0x00000001;
unsigned on1 = 0x00000002;
unsigned off = 0x00000000;
long data[noparse]/noparse = {1, 2, 3, 4}; // this data is not used - it's just an example
void main(void)
{
_dira(mask0, mask0); // The bits are set as outputs
_dira(mask1, mask1); //
// it is not a problem about the port A configuration because changing swaping toggle0 and toggle1 function makes pin 1 to oscilate while pin 0 is dead still
_coginit((int)data>>2, (int)toggle0>>2 , ANY_COG);
toggle1();
}
int toggle0(void)
{
while(1)
{
_outa(mask0,off);
_outa(mask0,on0);
}
return(1);
}
int toggle1(void)
{
while(1)
{
_outa(mask1,off);
_outa(mask1,on1);
}
return(1);
}
Thanks again Ross,
Damineitor
Yes, the problem is that Catalina's _coginit function is a copy of the PASM equivalent, not the SPIN version. It only accepts a PASM program. It cannot accept C code since executing this type of code requires that the cog be running the LMM kernel.
I intend adding the ability to launch a new LMM kernel to a future version of Catalina. This would allow you to launch a C program in another cog.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
unsigned long code[noparse]/noparse = {
// entry
0x68ffec01, // or dira, #LED_PIN
0x64ffe801, // andn outa, #LED_PIN
0xa0bc0ff1, // mov count,cnt
0x80bc0e08, // add count,increment
0xf8bc0e08, // loop
// waitcnt count, increment
0x6cffe801, // xor outa, #LED_PIN
0x5c7c0004, // jmp #loop
0x00000000, // count long 0
0x05F5E100 // increment long 100000000
};
Thank you Ross,
Damineitor
Sorry, there is no easy way at present. I use homespun to get a listing and take the compiled version from that - or you could use bstc. Or you can use any hex editor to pull the section out of a compiled binary file. Just remember that if you are representing it as longs (as shown in my example, and in your post) that this may require you to reverse the byte ordering. Try compiling this example in SPIN, and then compare it to the version in your post and you will see what I mean:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Below is a link to a windows application that will convert a spin .binary file DAT section to a C ASCII-HEX array.
Write your PASM in a spin file (just one dat section please), and create a .binary, then run spinc on it.
The output should be a nicely formatted C array. Either it works or it doesn't ... that's all I can do for you.
Good luck.
--Steve
http://forums.parallax.com/attachment.php?attachmentid=61769
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Pages: Propeller JVM