Not enough COGs??
rkrasowski
Posts: 16
Good.zipHere we go again,
Let me first describe my project:
Telemetry box that has GPS, Pressure sensor, 3axis accelerometer, XBee transceiver and SDcard to record the data. The idea is transmit telemetry from "box" to the computer via XBee, on top of that record data into SDcard that is attached into propeller board. Finally with you help I was able to get all "modules" working. Now routine starts from GPS that required 2 COGs to function : one for NMEA interpretation and one for mini serial communicator, after that I start accelerometer that required one COG for serial communication, next go XBee that again one COG for serial communication next pressure sensor that is COG hungry - use 3 COG,s and the last thing - SDcard which I understand use only 1 COG. Everything was working nice untill finally I was able to get my pressure sensor to work, now routine gets to the point of mounting SD card and tells me not able to mount (this is last thing that program is trying to do). My understanding is that probably I run out of COGs. Do I understand correctly?? If so how to overcome this problem, does that means that I will have to stop some of the COG to record into SDcard and than restart it again to do let say stop Pressure routine??
Attached is the code for entire project. it start with file main.spin
Thanks like always
Robert
Let me first describe my project:
Telemetry box that has GPS, Pressure sensor, 3axis accelerometer, XBee transceiver and SDcard to record the data. The idea is transmit telemetry from "box" to the computer via XBee, on top of that record data into SDcard that is attached into propeller board. Finally with you help I was able to get all "modules" working. Now routine starts from GPS that required 2 COGs to function : one for NMEA interpretation and one for mini serial communicator, after that I start accelerometer that required one COG for serial communication, next go XBee that again one COG for serial communication next pressure sensor that is COG hungry - use 3 COG,s and the last thing - SDcard which I understand use only 1 COG. Everything was working nice untill finally I was able to get my pressure sensor to work, now routine gets to the point of mounting SD card and tells me not able to mount (this is last thing that program is trying to do). My understanding is that probably I run out of COGs. Do I understand correctly?? If so how to overcome this problem, does that means that I will have to stop some of the COG to record into SDcard and than restart it again to do let say stop Pressure routine??
Attached is the code for entire project. it start with file main.spin
Thanks like always
Robert
Comments
GPS_IO_mini may also get away with just using Simple_Serial.
or maybe the Accelerometer cog, while You are sending data to the XBee.
stop the data send cogs while You get data and save data to variable of your choice, then stop the data get cogs,
then restart the data send cogs, then send/record the data... Lather Rinse and Repeat, yes?
Look up Cogstop in the Prop Manual and see if that helps make sense of what I just typed...
Cheers
peter (pjv)
The 4 port serial object Mike refers to, saved me.
Time Moore wrote it. Here's a link.
Anyway, if your pressure sensor and accelerometer are I2C, they can share a cog for the low level. This should remove any timing constraint. You can also share the pins with the eeprom here.
The 4 port serial, as has been suggested will save you too.
The SD will require 2 cogs, 1 for the low level, and 1 for the FAT routines. However, you maybe able to dispense with the FAT routines if you have a fixed contiguous file or you do not use FAT.
Thanks again.
PS
Cluso99, thanks for input, I see fantastic boat as your logo, let me tell you what is this project of mine all about. I have PSKMail server for emailing, at home, I added "Boat Link" that allows chat over the internet with boat that are connected into my server. On top of that you can request telemetry data from internet that you get from "telemetry box" that I am constructing now. Everything is written in PERL - for boat link, PSKMail in Java, internet siede in PHP and now time for Propeller and telemetry box.
You can see entire project on my internet side www.anchorsat.info. Boat link does not exist in english version of my page, only on Polish, sorry no time to update my side.
Thanks again for your help
Robert
KB2PNM