@enorton said:
Ok on to the nitty gritty stuff... I need these peripherals:
Two serial ports at 115200 baud with interrupts if that is possible. Would one cog be used for serial communication? Would I even need interrupts if it is in its own cog/core? Do you have an example with functions I can see to implement two serial ports?
I need three I2C peripherals. All three are relatively slow 100kHz. Do you have an example with functions?
I need one SPI peripheral with four chip selects. Do you have an example with functions?
One 32-bit timer with compare interrupt. Do you have an example with functions?
UART, SPI and PWM are core capabilities of the smart pins.
i2c needs software, but is usually slow enough to manage
Timer with compare int is interesting.
It's not a specific mode, but maybe you can use PWM and INT on the pin change. (costs a pin and is 16bits )
or NCO mode says this : Set Y[31:0] to that value so it gets added to Z[31:0] at each base period. The Smart Pin circuit raises the IN flag whenever the Z register overflows.
So the overflow signal may be useful, if you preload as the compare value and then wait for overflow ?
I am so close to abandoning the Propeller 2 chip because the tools are not streamlined or ready for use yet. If someone can show me something that I can use for large designs and I can use C and program the chip through the IDE I will stick with the Propeller 2 chip. If not, I will be forced to set the Propeller 2 chip aside (maybe return the development board) and go with an XMOS device since the tools are already there and I can port over to their IDE which is Eclipse.
I'm sure the XMOS is a very nice chip for some purposes, but it is not nearly as much fun as the Propeller
Ross.
How do I store the program in Flash on the dev board? Is there a command in the properties for this? I would like to eventually be able to store the program on the SD card so I can send a customer the new file and they can load it onto their SD card.
There is a flash_payload command. See the Catalina Propeller 2 Reference manual.
Also, Catalina comes with catalyst - a complete SD card program loader and set of utilities. See the Catalyst Reference Manual.
@enorton said:
Ok on to the nitty gritty stuff... I need these peripherals:
Two serial ports at 115200 baud with interrupts if that is possible. Would one cog be used for serial communication? Would I even need interrupts if it is in its own cog/core? Do you have an example with functions I can see to implement two serial ports?
I need three I2C peripherals. All three are relatively slow 100kHz. Do you have an example with functions?
I need one SPI peripheral with four chip selects. Do you have an example with functions?
One 32-bit timer with compare interrupt. Do you have an example with functions?
UART, SPI and PWM are core capabilities of the smart pins.
i2c needs software, but is usually slow enough to manage
Timer with compare int is interesting.
It's not a specific mode, but maybe you can use PWM and INT on the pin change. (costs a pin and is 16bits )
or NCO mode says this : Set Y[31:0] to that value so it gets added to Z[31:0] at each base period. The Smart Pin circuit raises the IN flag whenever the Z register overflows.
So the overflow signal may be useful, if you preload as the compare value and then wait for overflow ?
Very interesting... I'm still trying to get my brain wrapped around the P2 concept, how it works, and how it can make my life easier/better. I have a lot to read and digest. This is certainly not an easy device to get a grasp of. It takes what I already know about microcontrollers and tosses it out the window. My stubbornness wants the easy route, but my curiosity wants to fully understand the capabilities of the device so this may take a while...
Two serial ports at 115200 baud with interrupts if that is possible. Would one cog be used for serial communication? Would I even need interrupts if it is in its own cog/core? Do you have an example with functions I can see to implement two serial ports?
Catalina supports a 2 port serial plugin - this uses a cog. You probably won't need interrupts. In Catalina a 'plugin' is like a device driver that runs in a separate cog. Usually written in SPIN/PASM, although I generally rewrite the SPIN parts in C. There is a library to access the ports - libserial2.
I need three I2C peripherals. All three are relatively slow 100kHz. Do you have an example with functions?
I need one SPI peripheral with four chip selects. Do you have an example with functions?
SPI covers a lot of ground. You'll have to be more specific. I suggest posting what you need to support in a separate thread - someone probably has some code that can be re-used.
One 32-bit timer with compare interrupt. Do you have an example with functions?
The Propeller is very good on clocks and timers. Also, Catalina has a real-time clock plugin plus all the usual C time functions. You'll need to be a bit more specific, but I'm sure either the Propeller itself, or Catalina, can do what you need.
16 bit PWM output.
Check out the Propeller smartpin capabilities. They may already do what you need in just a few instructions.
How can I add these peripherals to my code in Catalina Geany?
Hard to be specific - some may need just a few inline PASM instructions (e.g. the smartpins), some may need a few new functions (e.g. the I2C), there may be an existing plugin (e.g. the 2 port serial) while others may need a new plugin (e.g. the SPI whatever).
Nearly all Catalina's plugins stated life as independent SPIN/PASM code written by other people. If the code already exists somewhere, it can generally be turned into a plugin fairly easily. Read up on 'plugins' in the Catalina manual - they are most general purpose method, but each one consumes one or more cogs, and so they can be expensive.
Ross.
Thanks Ross for the details. I really appreciate all your help :-)
I am so close to abandoning the Propeller 2 chip because the tools are not streamlined or ready for use yet. If someone can show me something that I can use for large designs and I can use C and program the chip through the IDE I will stick with the Propeller 2 chip. If not, I will be forced to set the Propeller 2 chip aside (maybe return the development board) and go with an XMOS device since the tools are already there and I can port over to their IDE which is Eclipse.
I'm sure the XMOS is a very nice chip for some purposes, but it is not nearly as much fun as the Propeller
Ross.
How do I store the program in Flash on the dev board? Is there a command in the properties for this? I would like to eventually be able to store the program on the SD card so I can send a customer the new file and they can load it onto their SD card.
There is a flash_payload command. See the Catalina Propeller 2 Reference manual.
Also, Catalina comes with catalyst - a complete SD card program loader and set of utilities. See the Catalyst Reference Manual.
@enorton What makes the propeller different, is also what makes it easy. You have 8 CPUs (cogs) that you can assign to tasks and the tasks can take actions based on what information you have in shared (hub) RAM . Most likely you won't even need the P2 interrupts.
@ke4pjw said:
@enorton What makes the propeller different, is also what makes it easy. You have 8 CPUs (cogs) that you can assign to tasks and the tasks can take actions based on what information you have in shared (hub) RAM . Most likely you won't even need the P2 interrupts.
--Terry
Yeah, I can appreciate the extra cogs/processors it's just different from what I am used to. I am still trying to figure it all out and it's not going to be quick that is for sure.
I have a rather large project written in C (89000ish lines of code) and want to port it to the Propeller 2 chip.
Hi @enorton
I meant to comment on this earlier, but only just remembered. Did you really mean 89000 lines of C code?
The largest C program I routinely compile for the Propeller is the Lua language interpreter. It is about 35000 lines of C code, and when compiled in various memory models, this results in the following code sizes:
MODEL SIZE
====== ====
COMPACT 232kb
NATIVE 406kb
LARGE 476kb
You don't need to worry what the various models mean - you can look them up in the Catalina documentation. But you do need to know that since a Propeller 2 only has 512kb RAM for all code, data, heap and stack, a program of 89000 lines of C code may not be executable on a 'bare' Propeller 2. However, it should be executable using the LARGE model on a Propeller 2 with external memory (aka XMM RAM) such as a P2 EDGE with the 32MB PSRAM chip, or if you can add the Hyper RAM add-on board.
Perhaps the '89000' was a typo? That's a lot of C code!
I have a rather large project written in C (89000ish lines of code) and want to port it to the Propeller 2 chip.
Hi @enorton
I meant to comment on this earlier, but only just remembered. Did you really mean 89000 lines of C code?
The largest C program I routinely compile for the Propeller is the Lua language interpreter. It is about 35000 lines of C code, and when compiled in various memory models, this results in the following code sizes:
MODEL SIZE
====== ====
COMPACT 232kb
NATIVE 406kb
LARGE 476kb
You don't need to worry what the various models mean - you can look them up in the Catalina documentation. But you do need to know that since a Propeller 2 only has 512kb RAM for all code, data, heap and stack, a program of 89000 lines of C code may not be executable on a 'bare' Propeller 2. However, it should be executable using the LARGE model on a Propeller 2 with external memory (aka XMM RAM) such as a P2 EDGE with the 32MB PSRAM chip, or if you can add the Hyper RAM add-on board.
Perhaps the '89000' was a typo? That's a lot of C code!
Ross.
That right there makes this a no-go for me. I don't want to add more complexity to the design. The more and more I get familiar with the P2 chip it just won't work for what I need it to do. I am getting frustrated with it already. I just don't have the time to create I2C and SPI bit bang stuff and I'm lost when you say "plugins". XMOS is better aligned with what I want to do. My application requires high-speed and reliable protocols that I don't have to spend hours trying to figure out how to create. UART is already done as an add-on and that's great for Catalina Geany but I don't see the I2C and SPI and I need these peripherals. I was able to create what I needed in the XMOS IDE and it took me less than a few hours to do.
The P2 chip is nice but not fit for my application. Thank you for all your help I really do appreciate it.
I have a rather large project written in C (89000ish lines of code) and want to port it to the Propeller 2 chip.
Hi @enorton
I meant to comment on this earlier, but only just remembered. Did you really mean 89000 lines of C code?
The largest C program I routinely compile for the Propeller is the Lua language interpreter. It is about 35000 lines of C code, and when compiled in various memory models, this results in the following code sizes:
MODEL SIZE
====== ====
COMPACT 232kb
NATIVE 406kb
LARGE 476kb
You don't need to worry what the various models mean - you can look them up in the Catalina documentation. But you do need to know that since a Propeller 2 only has 512kb RAM for all code, data, heap and stack, a program of 89000 lines of C code may not be executable on a 'bare' Propeller 2. However, it should be executable using the LARGE model on a Propeller 2 with external memory (aka XMM RAM) such as a P2 EDGE with the 32MB PSRAM chip, or if you can add the Hyper RAM add-on board.
Perhaps the '89000' was a typo? That's a lot of C code!
Ross.
That right there makes this a no-go for me. I don't want to add more complexity to the design. The more and more I get familiar with the P2 chip it just won't work for what I need it to do. I am getting frustrated with it already. I just don't have the time to create I2C and SPI bit bang stuff and I'm lost when you say "plugins". XMOS is better aligned with what I want to do. My application requires high-speed and reliable protocols that I don't have to spend hours trying to figure out how to create. UART is already done as an add-on and that's great for Catalina Geany but I don't see the I2C and SPI and I need these peripherals. I was able to create what I needed in the XMOS IDE and it took me less than a few hours to do.
The P2 chip is nice but not fit for my application. Thank you for all your help I really do appreciate it.
Thanks,
Eric
Were you able to compile it all under flexcc, passing all the C files on the command line as suggested by @Wuerfel_21 and compiling it to bytecode as suggested by @bob_g4bby so that it fits in RAM? Did it not fit? Does your 89000 number include comments and blank lines, or do you actually have 89000 SLOC?
I have a rather large project written in C (89000ish lines of code) and want to port it to the Propeller 2 chip.
Hi @enorton
I meant to comment on this earlier, but only just remembered. Did you really mean 89000 lines of C code?
The largest C program I routinely compile for the Propeller is the Lua language interpreter. It is about 35000 lines of C code, and when compiled in various memory models, this results in the following code sizes:
MODEL SIZE
====== ====
COMPACT 232kb
NATIVE 406kb
LARGE 476kb
You don't need to worry what the various models mean - you can look them up in the Catalina documentation. But you do need to know that since a Propeller 2 only has 512kb RAM for all code, data, heap and stack, a program of 89000 lines of C code may not be executable on a 'bare' Propeller 2. However, it should be executable using the LARGE model on a Propeller 2 with external memory (aka XMM RAM) such as a P2 EDGE with the 32MB PSRAM chip, or if you can add the Hyper RAM add-on board.
Perhaps the '89000' was a typo? That's a lot of C code!
Ross.
That right there makes this a no-go for me. I don't want to add more complexity to the design. The more and more I get familiar with the P2 chip it just won't work for what I need it to do. I am getting frustrated with it already. I just don't have the time to create I2C and SPI bit bang stuff and I'm lost when you say "plugins". XMOS is better aligned with what I want to do. My application requires high-speed and reliable protocols that I don't have to spend hours trying to figure out how to create. UART is already done as an add-on and that's great for Catalina Geany but I don't see the I2C and SPI and I need these peripherals. I was able to create what I needed in the XMOS IDE and it took me less than a few hours to do.
The P2 chip is nice but not fit for my application. Thank you for all your help I really do appreciate it.
Thanks,
Eric
Were you able to compile it all under flexcc, passing all the C files on the command line as suggested by @Wuerfel_21 and compiling it to bytecode as suggested by @bob_g4bby so that it fits in RAM? Did it not fit? Does your 89000 number include comments and blank lines, or do you actually have 89000 SLOC?
89k including comments. Actual lines of C code are about 80k but as I said earlier it will likely grow. I'm not worried about that much at the moment. I am having trouble trying to get protocols like I2C and SPI to work. That right there is troubling for me. I don't want to use SPIN2 or PASM because I don't have the time to learn new languages. I can't even figure out how in the world to use open collector pins for I2C. Where is that information? Why is it not an option in the datasheet? Where are low-level peripheral examples in C for I2C and SPI for Propeller 2? Taking stuff from the Propeller 1 and trying to make it work for the Propeller 2 chips is not ideal. I don't want to spend a few weeks trying to create robust protocols for a chip.
I prefer Spin and PASM myself, but I agree you wouldn't gain anything from porting all your code. Nevertheless, I'd recommend gaining at least just enough familiarity with Spin2 to be able to understand examples. It's not a very complicated language. With flexspin/flexcc, Spin smartpin examples should translate pretty directly into C, since they both call the same underlying functions.
The datasheet is just that, a datasheet and not a manual; detailed documentation can be found in some of the other documents. I still use Chip's original documentation and not Parallax's more recently released official documentation, which was still less complete last time I checked.
@Electrodude said:
I prefer Spin and PASM myself, but I agree you wouldn't gain anything from porting all your code. Nevertheless, I'd recommend gaining at least just enough familiarity with Spin2 to be able to understand examples. It's not a very complicated language. With flexspin/flexcc, Spin smartpin examples should translate pretty directly into C, since they both call the same underlying functions.
The datasheet is just that, a datasheet and not a manual; detailed documentation can be found in some of the other documents. I still use Chip's original documentation and not Parallax's more recently released official documentation, which was still less complete last time I checked.
I just don't have the time to invest in trying to learn something new and that could take months with everything going on. Porting 80K worth of C code is a nightmare to even think about. I'm in no way bashing the Propeller 2 chip at all it's just that luxury of time is not on my side and trying to concentrate long enough without getting interrupted to do something else makes it all the more difficult.
@Electrodude said:
I prefer Spin and PASM myself, but I agree you wouldn't gain anything from porting all your code. Nevertheless, I'd recommend gaining at least just enough familiarity with Spin2 to be able to understand examples. It's not a very complicated language. With flexspin/flexcc, Spin smartpin examples should translate pretty directly into C, since they both call the same underlying functions.
The datasheet is just that, a datasheet and not a manual; detailed documentation can be found in some of the other documents. I still use Chip's original documentation and not Parallax's more recently released official documentation, which was still less complete last time I checked.
I just don't have the time to invest in trying to learn something new and that could take months with everything going on. Porting 80K worth of C code is a nightmare to even think about. I'm in no way bashing the Propeller 2 chip at all it's just that luxury of time is not on my side and trying to concentrate long enough without getting interrupted to do something else makes it all the more difficult.
Right; one of the best things about flexspin is how close it brings C and Spin and how it lets you freely mix them. So you leave your 80KLOC as it is in C, and have your C code call existing C or Spin code from e.g. the P2 Obex to manage all the peripherals. I guess you'd probably want to have a single C file in your project that gets called by the other parts of your code and which itself calls any Spin peripheral functions. You'll probably only need to write any C to do this, but you'll need to read some Spin.
SPI, I2C are already done and I have been using them for months now with no issues. Your right, You need time to figure out the environment which you just don't have.
I have ported several devices from Arduino, Sparkfun, and Adafruit with no issues.
C code on the P2 is not the main coding style for most of the P2 community here but I don't do SPIN and preferer C for its tight code generation.
I could probably convert your code over to the P2 as a proof of concept.
I agree with Mike -- except that I'm a Spin programmer. He's right: the P2 is new to you and it will take a little time to come up to speed. Once you do, no matter what language you select, you'll find yourself very productive.
SPI, I2C are already done and I have been using them for months now with no issues.
I have ported several devices from Arduino, Sparkfun, and Adafruit with no issues.
Me, too.
Give yourself a bit of time; giving your experience you'll have to adjust your approach a bit, but once the "Aha!" light kicks on, you'll start having a lot of fun.
@JonnyMac said:
I agree with Mike -- except that I'm a Spin programmer. He's right: the P2 is new to you and it will take a little time to come up to speed. Once you do, no matter what language you select, you'll find yourself very productive.
SPI, I2C are already done and I have been using them for months now with no issues.
I have ported several devices from Arduino, Sparkfun, and Adafruit with no issues.
Me, too.
Give yourself a bit of time; giving your experience you'll have to adjust your approach a bit, but once the "Aha!" light kicks on, you'll start having a lot of fun.
I'm waiting for the aha moment lol. It's a lot to digest... I just need to take a step back and take a different approach.
@iseries said:
SPI, I2C are already done and I have been using them for months now with no issues. Your right, You need time to figure out the environment which you just don't have.
I have ported several devices from Arduino, Sparkfun, and Adafruit with no issues.
C code on the P2 is not the main coding style for most of the P2 community here but I don't do SPIN and preferer C for its tight code generation.
I could probably convert your code over to the P2 as a proof of concept.
Mike
Catalina Geany is the only IDE I have found to be able to create a project with. I need a multi-file environment because there is absolutely no way I'm putting 80k plus lines of code into a single file.
I cannot share the source code with anyone unfortunately. I'd really like it if someone had a c library for the I2C and SPI peripherals. I'd even pay to have it created as a plugin into Catalina Geany if that's what it takes...
The great fun with the Propeller is the multiple cogs -- once the idea sits firmly in your guts. For example, yesterday I helped a client with a new product he's developing. He asked for a special driver. Now, he's on the east coast, I'm out west, and I don't have the hardware he wants the Propeller to listen to. No problem; he showed me what the data coming from the device looks which allowed me to write code that runs in its own cog to simulate that device. This let me fine tune the listener code. He tested and it works with his hardware. This is not the first time I've written a specialized receiver for a device that I don't have on my desk. Since it's a P1 using bit-banged serial, I don't even have connect wires; the simulator cog transmits on a pin and the receiver cog listens on the same pin. That I can do this always makes me chuckle. This would not hold true for the P2 using a smart pin mode because the smart pin is universal (which is helpful in other areas), that is, a smart pin set up by any cog will be seen as a smart pin by all cogs.
I have all my libraries on github that include spi, and i2c. as well as serial. They were built for flex prop though so you would need to maybe convert them for use with Catalina.
@enorton there is a new version of FlexProp available now (6.1.0) which has support for very simple multi-file projects. A project file is just a text file containing a list of the files to compile, along with any definitions to be made a compile time. That may be sufficient for what you're doing.
Why do you think the Prop2 wont do I2C easily? Because it lacks “textbook” open-collector outputs?
Not so fast: The I2C bus has pull-ups to Vcc. For I2C you can either yank the P2 output pin to ground for a zero, or let it float for a one. You knew that, but you may have missed the ability for the P2 to float an output.
I’m doing I2C from FlexBASIC using PINLO(n) or PINFLOAT(n) and bit-bashing along at better than 1mhz without even trying. And kids… if I can do it…. Well… lets just say I think you’re probably a whole bunch smarter than I am, which tells me you just havent set your mind to it yet. 😁
@iseries said:
I have all my libraries on github that include spi, and i2c. as well as serial. They were built for flex prop though so you would need to maybe convert them for use with Catalina.
Ha! Very nice set of libraries - I just compiled a couple (i2c and spi) with Catalina, and all it took was a couple of trivial changes to make your C code ANSI compliant.
So, @enorton, I believe that's the last hurdle down!
@iseries said:
I have all my libraries on github that include spi, and i2c. as well as serial. They were built for flex prop though so you would need to maybe convert them for use with Catalina.
Ha! Very nice set of libraries - I just compiled a couple (i2c and spi) with Catalina, and all it took was a couple of trivial changes to make your C code ANSI compliant.
So, @enorton, I believe that's the last hurdle down!
Ross.
Oh REALLY :_D ??? Is it a new version of Catalina Geany I can download?
@iseries said:
I have all my libraries on github that include spi, and i2c. as well as serial. They were built for flex prop though so you would need to maybe convert them for use with Catalina.
Ha! Very nice set of libraries - I just compiled a couple (i2c and spi) with Catalina, and all it took was a couple of trivial changes to make your C code ANSI compliant.
So, @enorton, I believe that's the last hurdle down!
@iseries said:
I have all my libraries on github that include spi, and i2c. as well as serial. They were built for flex prop though so you would need to maybe convert them for use with Catalina.
Comments
You likely already have this open
https://www.parallax.com/propeller-2/documentation/
and the _Propeller 2 Smart Pin Supplementary Documentation _
UART, SPI and PWM are core capabilities of the smart pins.
i2c needs software, but is usually slow enough to manage
Timer with compare int is interesting.
It's not a specific mode, but maybe you can use PWM and INT on the pin change. (costs a pin and is 16bits )
or NCO mode says this :
Set Y[31:0] to that value so it gets added to Z[31:0] at each base period. The Smart Pin circuit raises the IN flag whenever the Z register overflows.
So the overflow signal may be useful, if you preload as the compare value and then wait for overflow ?
There is a flash_payload command. See the Catalina Propeller 2 Reference manual.
Also, Catalina comes with catalyst - a complete SD card program loader and set of utilities. See the Catalyst Reference Manual.
Very interesting... I'm still trying to get my brain wrapped around the P2 concept, how it works, and how it can make my life easier/better. I have a lot to read and digest. This is certainly not an easy device to get a grasp of. It takes what I already know about microcontrollers and tosses it out the window. My stubbornness wants the easy route, but my curiosity wants to fully understand the capabilities of the device so this may take a while...
Thanks Ross for the details. I really appreciate all your help :-)
Thank you for this. I will read up on that.
@enorton What makes the propeller different, is also what makes it easy. You have 8 CPUs (cogs) that you can assign to tasks and the tasks can take actions based on what information you have in shared (hub) RAM . Most likely you won't even need the P2 interrupts.
--Terry
Yeah, I can appreciate the extra cogs/processors it's just different from what I am used to. I am still trying to figure it all out and it's not going to be quick that is for sure.
Hi @enorton
I meant to comment on this earlier, but only just remembered. Did you really mean 89000 lines of C code?
The largest C program I routinely compile for the Propeller is the Lua language interpreter. It is about 35000 lines of C code, and when compiled in various memory models, this results in the following code sizes:
You don't need to worry what the various models mean - you can look them up in the Catalina documentation. But you do need to know that since a Propeller 2 only has 512kb RAM for all code, data, heap and stack, a program of 89000 lines of C code may not be executable on a 'bare' Propeller 2. However, it should be executable using the LARGE model on a Propeller 2 with external memory (aka XMM RAM) such as a P2 EDGE with the 32MB PSRAM chip, or if you can add the Hyper RAM add-on board.
Perhaps the '89000' was a typo? That's a lot of C code!
Ross.
That right there makes this a no-go for me. I don't want to add more complexity to the design. The more and more I get familiar with the P2 chip it just won't work for what I need it to do. I am getting frustrated with it already. I just don't have the time to create I2C and SPI bit bang stuff and I'm lost when you say "plugins". XMOS is better aligned with what I want to do. My application requires high-speed and reliable protocols that I don't have to spend hours trying to figure out how to create. UART is already done as an add-on and that's great for Catalina Geany but I don't see the I2C and SPI and I need these peripherals. I was able to create what I needed in the XMOS IDE and it took me less than a few hours to do.
The P2 chip is nice but not fit for my application. Thank you for all your help I really do appreciate it.
Thanks,
Eric
Were you able to compile it all under flexcc, passing all the C files on the command line as suggested by @Wuerfel_21 and compiling it to bytecode as suggested by @bob_g4bby so that it fits in RAM? Did it not fit? Does your 89000 number include comments and blank lines, or do you actually have 89000 SLOC?
89k including comments. Actual lines of C code are about 80k but as I said earlier it will likely grow. I'm not worried about that much at the moment. I am having trouble trying to get protocols like I2C and SPI to work. That right there is troubling for me. I don't want to use SPIN2 or PASM because I don't have the time to learn new languages. I can't even figure out how in the world to use open collector pins for I2C. Where is that information? Why is it not an option in the datasheet? Where are low-level peripheral examples in C for I2C and SPI for Propeller 2? Taking stuff from the Propeller 1 and trying to make it work for the Propeller 2 chips is not ideal. I don't want to spend a few weeks trying to create robust protocols for a chip.
I prefer Spin and PASM myself, but I agree you wouldn't gain anything from porting all your code. Nevertheless, I'd recommend gaining at least just enough familiarity with Spin2 to be able to understand examples. It's not a very complicated language. With flexspin/flexcc, Spin smartpin examples should translate pretty directly into C, since they both call the same underlying functions.
The datasheet is just that, a datasheet and not a manual; detailed documentation can be found in some of the other documents. I still use Chip's original documentation and not Parallax's more recently released official documentation, which was still less complete last time I checked.
https://www.parallax.com/propeller-2/documentation/
I just don't have the time to invest in trying to learn something new and that could take months with everything going on. Porting 80K worth of C code is a nightmare to even think about. I'm in no way bashing the Propeller 2 chip at all it's just that luxury of time is not on my side and trying to concentrate long enough without getting interrupted to do something else makes it all the more difficult.
Figure out the I/O issue and you'll be off-to-the races 😁
Those XMOS devices look pretty scary to me and what about availability? Digikey aren't showing many in stock🤔
Craig
Right; one of the best things about flexspin is how close it brings C and Spin and how it lets you freely mix them. So you leave your 80KLOC as it is in C, and have your C code call existing C or Spin code from e.g. the P2 Obex to manage all the peripherals. I guess you'd probably want to have a single C file in your project that gets called by the other parts of your code and which itself calls any Spin peripheral functions. You'll probably only need to write any C to do this, but you'll need to read some Spin.
Here's what calling Spin code from C looks like: https://github.com/totalspectrum/spin2cpp/blob/master/doc/c.md#external-classes-eg-spin-objects
SPI, I2C are already done and I have been using them for months now with no issues. Your right, You need time to figure out the environment which you just don't have.
I have ported several devices from Arduino, Sparkfun, and Adafruit with no issues.
C code on the P2 is not the main coding style for most of the P2 community here but I don't do SPIN and preferer C for its tight code generation.
I could probably convert your code over to the P2 as a proof of concept.
Mike
I agree with Mike -- except that I'm a Spin programmer. He's right: the P2 is new to you and it will take a little time to come up to speed. Once you do, no matter what language you select, you'll find yourself very productive.
Me, too.
Give yourself a bit of time; giving your experience you'll have to adjust your approach a bit, but once the "Aha!" light kicks on, you'll start having a lot of fun.
I'm waiting for the aha moment lol. It's a lot to digest... I just need to take a step back and take a different approach.
Small steps.
Catalina Geany is the only IDE I have found to be able to create a project with. I need a multi-file environment because there is absolutely no way I'm putting 80k plus lines of code into a single file.
I cannot share the source code with anyone unfortunately. I'd really like it if someone had a c library for the I2C and SPI peripherals. I'd even pay to have it created as a plugin into Catalina Geany if that's what it takes...
Yes, small steps...
The great fun with the Propeller is the multiple cogs -- once the idea sits firmly in your guts. For example, yesterday I helped a client with a new product he's developing. He asked for a special driver. Now, he's on the east coast, I'm out west, and I don't have the hardware he wants the Propeller to listen to. No problem; he showed me what the data coming from the device looks which allowed me to write code that runs in its own cog to simulate that device. This let me fine tune the listener code. He tested and it works with his hardware. This is not the first time I've written a specialized receiver for a device that I don't have on my desk. Since it's a P1 using bit-banged serial, I don't even have connect wires; the simulator cog transmits on a pin and the receiver cog listens on the same pin. That I can do this always makes me chuckle. This would not hold true for the P2 using a smart pin mode because the smart pin is universal (which is helpful in other areas), that is, a smart pin set up by any cog will be seen as a smart pin by all cogs.
Heck, we're talking microcontrollers, I use includes and Notepad++ 😐
That VS, whatever was a PITA.
I want for nothing re: source management.
Craig
I have all my libraries on github that include spi, and i2c. as well as serial. They were built for flex prop though so you would need to maybe convert them for use with Catalina.
Mike
P2Custom Libraries
@enorton there is a new version of FlexProp available now (6.1.0) which has support for very simple multi-file projects. A project file is just a text file containing a list of the files to compile, along with any definitions to be made a compile time. That may be sufficient for what you're doing.
Why do you think the Prop2 wont do I2C easily? Because it lacks “textbook” open-collector outputs?
Not so fast: The I2C bus has pull-ups to Vcc. For I2C you can either yank the P2 output pin to ground for a zero, or let it float for a one. You knew that, but you may have missed the ability for the P2 to float an output.
I’m doing I2C from FlexBASIC using PINLO(n) or PINFLOAT(n) and bit-bashing along at better than 1mhz without even trying. And kids… if I can do it…. Well… lets just say I think you’re probably a whole bunch smarter than I am, which tells me you just havent set your mind to it yet. 😁
Ha! Very nice set of libraries - I just compiled a couple (i2c and spi) with Catalina, and all it took was a couple of trivial changes to make your C code ANSI compliant.
So, @enorton, I believe that's the last hurdle down!
Ross.
Oh REALLY :_D ??? Is it a new version of Catalina Geany I can download?
Thank you Ross :-)
Thank you Mike I will check this out :-)