Parallax Forums
  HomeLog InRegisterCommunity CalendarSearch the ForumHelp
   
Parallax Forums > Public Forums > Propeller Chip > TriBladeProp PCB: Uses 3 Propeller ICs for a Single Board Computer (SBC)  Forum Quick Jump
 
New Topic Post Reply Printable Version
848 posts in this thread.
Viewing Page :
 
[ << Previous Thread | Next Thread >> ] | Show Newest Post First ]

heater
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2008
Total Posts : 1832
 
   Posted 11/2/2009 4:15 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Dr_A: Yes but if you look at:

if (brlong(@buf+$36) == constant("F" + ("A" << 8) + ("T" << 16) + ("1" << 24)))


long enough you will see that what it is really doing is a comparison between two longs. The one on the right hand side being a constant that is calculated at compile time not at run time. Much faster than doing a string comparison at run time.

As you know its not possible to put PASM inline with Spin so unless the whole thing is rewritten in PASM (and it fits in a COG) it's not really possible to do much better.

Can't really help with the CS thing much but I'm sure you will find some PASM code somewhere in the low level SD driver that is monitoring the content of the "control" structure and performing whatever commands are written there by the Spin code. Like for example the line:

long[control][0] := ioSpiInit << 24 | DO << 18 | Clk << 12 | DI << 6 | CS


which looks like it is writing an initialization command into the "control" array including the CS bit. Some where I'm sure there is some PASM that sees that ioSpint command and starts to tweak CS etc with some OUTA instructions.
Also looks like when the PASM has completed the command it will write ioTestRdy back to the "control" array to tell the Spin that the command is done and that it may continue hence the:

repeat while long[control][0] & ioTestRdy            ' Wait for this to finish


in Spin which is waiting for PASM to say done with ioTestRdy equal true.

Arranging for debug messages from PASM is tough. Hence I debugged ZiCog initially by just lighting/flashing a LED or two with OUTA.


For me, the past is not over yet.

Back to Top
 

Dr_Acula
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2008
Total Posts : 606
 
   Posted 11/2/2009 4:58 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Thanks heater. I have so much working on the board - vga, keyboard, low level PASM to read and write bytes to a ram chip. Just need to pull it all together. It is a bit frustrating as Cluso said that the SD card would be the easy bit - just change the pins over to whatever you are using, but it is turning out to be the really hard part. And the SD card is the reason I'm over here at the prop forum as it has defeated all but one member of the N8VEM group (Juha seems to have disappeared though he did leave us with some SD card code in Z80. But no-one else understands it). So in a way, the SD card code that the prop uses is rather unique.

The triblade code has some initialisation code that switches between the SD card and the ram, and this might be a problem. The only thing is that I can't find where this code might be being called from. As far as I can trace, it jumps straight into the SD card code before even thinking about talking to the ram. But then again, one would have expected Cluso's triblade code to at least tristate the ram chip out before attempting to talk to the SD card.

Re Arranging for debug messages from PASM is tough. Hence I debugged ZiCog initially by just lighting/flashing a LED or two with OUTA.

I was kind of hoping that wasn't the case. But since that is the way to do things, I at least do have some PASM code to flash a led on this particular board:

' **********************************************************************************************************
LedHigh ' turn led on, leave other pins low, assumes setup already done
                        mov outa,HC138A16_18            ' set data lines to zero, gate high and select A16-18 latch
                        or outa,#8                      ' turn the led bit on  00001000
                        andn outa,GateHigh              ' set gate low
                        or outa,GateHigh                ' set it high again
LedHigh_ret             ret


Tracing through SD code that doesn't work is going to be very tedious as I don't know what it is supposed to be doing! It may be easier to go back to the Z80 code and build an SD card reader/writer for the N8VEM. Though if it can just get to the stage of selecting the /CS line the rest ought to work.

I think you might be right in that it puts the data into an array, then reads it out somewhere else. Hopefully Cluso will have some ideas. I think he was looking at a complete new set of faster sd code anyway.


www.smarthome.viviti.com/build

Back to Top
 

BradC
Gronk



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2007
Total Posts : 1576
 
   Posted 11/2/2009 5:03 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
heater said...

Arranging for debug messages from PASM is tough. Hence I debugged ZiCog initially by just lighting/flashing a LED or two with OUTA.


I've always found debugging from PASM _really_ easy. I either use tv_text or a serial port, and just have one cog sitting there pulling data from a long or series of longs in a defined place in ram. The code I'm debugging just does wrlongs with the data I want to see. That does rely on you having at least one cog spare. If you only have _one_ cog spare, then run simple serial and a loop in spin, otherwise use fdx or tv_text.


If you always do what you always did, you always get what you always got.

Back to Top
 

heater
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2008
Total Posts : 1832
 
   Posted 11/2/2009 5:30 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Brad, that's what I meant by tough:)


For me, the past is not over yet.

Back to Top
 

BradC
Gronk



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2007
Total Posts : 1576
 
   Posted 11/2/2009 5:48 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
heater said...
Brad, that's what I meant by tough:)


Sorry, I missed the sarcasm.

I use the LED too, but now I have a reasonable DSO it's pure luxury :)

I still use TV_TEXT and FDX. Particularly now I have the integrated terminal that I don't need to switch into and out of, serial debugging with F10 is much easier.

For TX_TEXT I have PiP in the top right of my PC monitor, so I just pop the NTSC in there and get it all on one screen.

I recently went back to a PIC for a project and really missed the ease of firing up a debug cog.


If you always do what you always did, you always get what you always got.

Back to Top
 

heater
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2008
Total Posts : 1832
 
   Posted 11/2/2009 6:12 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Actually I was not meaning to be so sarcastic. I was just used to the idea that when debugging ZiCog the only serial port I had was tied up with the CP/M console emulation. The Spin the ran that was waiting on the emulation PASM that I was trying to debug. So it got a bit tougher that normal.

As it is I ended up with a single step mode in the emulation such that pretty much anything could be dumped to HUB by the PASM which then halted emulation and hence the Spin could display it along with regular Z80 register dumps.


For me, the past is not over yet.

Back to Top
 

Yoda
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2009
Total Posts : 61
 
   Posted 11/2/2009 9:13 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
James,

Exactly what are you trying to do? Are you tyring to eliminate the /CS that Cluso put in or do something else? If it is the former, why not take the stock SD code instead of the one Cluso modified for the SD routines.

Dave
Back to Top
 

Cluso99
We live onboard



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2008
Total Posts : 2276
 
   Posted 11/2/2009 1:20 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
James: The code you are looking at is talking via the long to another cog running pasm. Once this cog executes the command, it returns a value in that hub long, allowing the spin code to continue. It is a fairly common method used for inter-cog communication. I have not delved that much into this code. It is an object that works, save for the bit that did not release the DO pin once CS was released. That was the only patch I had to do.

I guess what you are trying to do is be able to understand how the SD card works.

If you want to write a Z80 routine to access the SD card, unfortunately, since I didn't write any of the SD access routines, I cannot help you here.

If you are trying to get it to work on the prop board with all the latches you designed, then providing the 4 SD pins are not shared with or on a latch, then the SD routines should just work. Here I would suggest you go back to something simpler and get the basics working. Try PropCmd or PropDOS to get the SD running first. This will prove the driver. That is what I did and it was a walk in the park.


Links to other interesting threads:
Back to Top
 

Dr_Acula
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2008
Total Posts : 606
 
   Posted 11/3/2009 4:29 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
If you are trying to get it to work on the prop board with all the latches you designed, then providing the 4 SD pins are not shared with or on a latch, then the SD routines should just work.

Hi Cluso,

No, unfortunately it doesn't work.

The hardware is very simple. 4 propeller pins to 4 pins on a standard sized SD card. Those pins don't go to anything else so there are no conflicts.

I tried a very simple bit of PASM code just to prove that the wires connecting the propeller to the SD card were connected.

' ********************************************************************************************************
CSLow ' set /CS pin low on the SD card for testing purposes /CS=pin9, CLK=pin14, /DI=Pin15 (and DO=13 HiZ)
SDLowDirect  long %00000000_00000000_11000010_00000000  ' direction of pins
                        mov dira,SDLowDirect            ' set pins as outputs
SDLow        long %00000000_00000000_00000000_00000000  ' set /CS, DI and Clk low
                        mov outa,SDLow
CSLow_ret               ret


This at least works - the volts go to the card and can be set high or low.

I looked at PropDOS but it appears to use a TV driver rather than VGA. I couldn't find PropCMD.

I guess what I need is to single step the fsrwFemto code one step at a time till it sets /CS low. In the Zicog code is a very useful debug routine;

  UART.str (string("Test point"))


So I had a idea of putting that in the fsrw code:

pub mount_explicit(DO, Clk, DI, CS) | startBlk, sectorspercluster, reserved, rootentries, sectors
{{
'   Mount a volume.  The address passed in is passed along to the block
'   layer; see the currently used block layer for documentation.  If the
'   volume mounts, a 0 is returned, else abort is called.
}}
  UART.str (string("mounting SD card "))


But it gave an error in the compiler. So - is there a way of outputting text from within other objects?

Re Yoda
If it is the former, why not take the stock SD code instead of the one Cluso modified for the SD routines.

Yes, the idea I'm working on is putting CP/M into one propeller. Latest schematic attached. That means latches for the ram chip and hence slower code, but the upside is lower cost. I'm not 100% sure what Cluso changed in the SD driver code - a clue is a comment "'' RR20090917 _rr001 mount --> mount_explicit " but I'm not sure which bit. Do you have a link for the stock SD code by any chance?


www.smarthome.viviti.com/build

Post Edited (Dr_Acula) : 11/3/2009 12:39:50 PM GMT



File Attachment :
Propeller_v2_rename_as_pdf.txt   125KB (text/plain)
This file has been downloaded 8 time(s).
Back to Top
 

Cluso99
We live onboard



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2008
Total Posts : 2276
 
   Posted 11/3/2009 5:55 AM (GMT -8)    Quote This PostAlert An Admin About This Post.

James: Here is the original PropDos (it is in the obex). Yes it uses the TV. VGA is not that difficult to substitute, just a few calls need to be added to VGA spin and call the object TV. It's probably even easier to use FDX and just add the extra routines - I think I already did that for you with my FDX_rr004.

However, it may be easier in the long run to just run the first bit of the ZiCog spin code to read the SD card. I suspect you are not getting that far but maybe looking at other stuff which is not important. Strip what you dont want and use FDX to give you feedback.

BTW, you will still require my mods for passing the correct pin numbers (mount_explicit). At least you can compare the changes I have done.

I suspect you have a hardware design problem. Do you have 10K pullups on all 4 SD signals? You should have pullups. Have you supplied GND to both pins on the SD (the uSD only has 1)? Have you got DI and DO reversed? DI is not D1 and DO is not D0(zero)? OK

Here is the SD pinout http://pinouts.ru/Memory/sdcard_pinout.shtml

1=/CS, 2=DI, 3&6=GND, 4=3V3, 5=CLK, 7=DO, 8&9=nc

I suspect you may have missed the fact that pin 9 is the short in, then comes pins 1 to 8 ???


Links to other interesting threads:
  Search the Propeller forums (uses advanced Google search)
My cruising website is:  www.bluemagic.biz   MultiBladeProp is: www.bluemagic.biz/cluso.htm



File Attachment :
PropDOS_v1_6_Mar9_2008.zip   69KB (application/x-zip-compressed)
This file has been downloaded 2 time(s).
Back to Top
 

Cluso99
We live onboard



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2008
Total Posts : 2276
 
   Posted 11/3/2009 6:05 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
re VGA & TV. I suspect if you joined VGA pins 3 & 13 together and fed them into an RCA plug with GND and put them into a TV, you could use the TV object using pin group P16-19 (P16 not connected) it would work, just crazy colors! Presuming of course you can swipe the family TV.


Links to other interesting threads:
Back to Top
 

Toby Seckshund
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2009
Total Posts : 477
 
   Posted 11/3/2009 2:33 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Just got the Blade2 and PropCOMM2 going, so I have a self contained SBC now.

I tried to get cheap and just use one Xtal, as the two props were so close together. Big mistake. I never realized that the Xtal osc gets interupted whilst the prop is reset/ programmed, general confusion for a bit but now the second Xtal has been grafted on.

Also I have found it useful to read the software setups. Jeff has the Tx/Rx on P8 + P9, I thought it was on the usual P30 + P31 pair, a bit more air wire.

Anybody know how fast PropCOMM can be fed ? I have slowed the Blade2 to 38400.

PS I don't have pullups on the SD cards.


Style and grace : Nil point

Post Edited (Toby Seckshund) : 11/3/2009 10:50:57 PM GMT


Image Attachment :
Image Preview
PICT0789.JPG
  52KB (image/jpeg)
This image has been viewed 25 time(s).
Image Attachment :
Image Preview
PICT0790.JPG
  53KB (image/jpeg)
This image has been viewed 18 time(s).
Back to Top
 

Dr_Acula
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2008
Total Posts : 606
 
   Posted 11/3/2009 3:06 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Hi Cluso, thanks for the feedback.

Re "Strip what you dont want and use FDX to give you feedback.", what is FDX?

Actually, what I really need is the ability to output a short message back to the terminal for debugging purposes. I guess to write this in basic, one would use PRINT "Got to test point 1". Then in another subroutine, PRINT "Got to test point 2". I'm not sure how to translate that to spin, as the UART object works from the main routine but not from within other objects. So my understanding of the fundamentals of spin is obviosly flawed, as I was expecting spin calls to work from within other spin calls, not just from the 'main' rountine. And I presume that if that is the case, then it wouldn't matter whether you are sending text to the PC terminal or to a VGA or a TV object. Or maybe there is a way around that. (I know now it is not possible to drop in a line of spin code to print a message in the middle of PASM code). I guess I'm a guy who likes to pull things to bits to see how they work!

Re pullups on SD pins, since no other code is using the pins, would they not be left either high or low (never tristate)? Or could there be problems in the brief moment when the propeller restarts and the pins are tristated (and possibly oscillating at 50/60Hz from mains nearby?). I found this www.parallax.com/Portals/0/Downloads/docs/prod/comm/32313-SDCardAdapter-v1.0.pdf which has pullups. Is there a board that plugs into and some simple code to demonstrate how to use an SD card? Indeed, I did a bit of a search of google and found a few promising leads, but is there an example anywhere of a project that uses a standard sized sd card, with some simple code, and some photos of how the pins are connected and a schematic? It might have been a year or two ago before people moved on to the tiny micro sd cards?

I *think* the pinout is correct, ie the first pin is pin 9, then pin 1 etc. But some of the unused pins are floating and maybe need pullups as per that application note above. I'll put in the pullups once I can put a halt after the code that pulls /CS low.

Post edit: This is a darn fast forum. I post something asking for an SD card example, and as soon as I post, the post right above mine has an example! Toby, I see you have not just one, but *two* sd cards. Do you have a schematic for that and maybe a closeup photo of the connections round the sd card? Thanks++ in advance.


www.smarthome.viviti.com/build

Post Edited (Dr_Acula) : 11/3/2009 11:12:39 PM GMT

Back to Top
 

Cluso99
We live onboard



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2008
Total Posts : 2276
 
   Posted 11/3/2009 4:35 PM (GMT -8)    Quote This PostAlert An Admin About This Post.

Toby: Nice work and congratulations yeah  Another running ZiCog/CPM addict.

James: I know some have used the SD card without pullups. I certainly would put one on the /CS pin. The other 3 pins should be tristated when you leave the SD routine, but from recent discussion, you are not reaching this point.

FDX = FullDuplexSerial.spin object (or my slightly modified version)

AFAIK technically there should be no difference to the SD and microSD use by software, although the SPI interface is optional in the microSD implementation.

Try this thread for more info on the new fsrw object by lonesock & rokicki http://forums.parallax.com/forums/default.aspx?f=25&m=368563  I have posted simple code there to test the drivers so you may find that useful.

As for debugging using FDX from a lower level in the chain, I am unsure. You could basically duplicate the tx routine to put a character directly into the hub buffer and increment the pointer so FDX transmits it.


Links to other interesting threads:
Back to Top
 

Toby Seckshund
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2009
Total Posts : 477
 
   Posted 11/3/2009 11:56 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Dr_A

I'll draw up something and post later today.

The warm, self satified glow only lasted overnight. This morning I realize that via PropCOMM I can't switch drives, ok via PST, so there must be some character passing that isn't the same between the two (looks ok on its screen). It winges about "Must be a hard disk" spits out register values and then spits out its dummy.

I put the chips back into the stand alone Blade2 board and even then the survey on A> gives SD errors at the end of the Port reports. I think I may have done the EEPROM an injustice.


Style and grace : Nil point

Back to Top
 

heater
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2008
Total Posts : 1832
 
   Posted 11/4/2009 1:04 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Toby, your board looks really neat. Great stuff. You must have a really good iron.


For me, the past is not over yet.

Back to Top
 

Cluso99
We live onboard



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2008
Total Posts : 2276
 
   Posted 11/4/2009 1:14 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Toby: James uses TeraTerm on the pc to do the VT100 emulation and wordstar ran great. So maybe go back to that point.
 
BTW Provided you wired as per my circuit, which appears to be the case in the photo, you do have pullups on the SD card - they are via the resistor network on the latch. I presume you have the extra 2 pullup resistors on P28 & P29 for the eeprom.


Links to other interesting threads:
Back to Top
 

Toby Seckshund
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2009
Total Posts : 477
 
   Posted 11/4/2009 1:20 AM (GMT -8)    Quote This PostAlert An Admin About This Post.

 Dr_A

As I was sat in the morning traffic jam I wondered if you were gettint one of the sme problems as I had, when I tried PropDos etc at first Then none of the "SD" cards I tried would mount. I had an 8MB, a 16MB and a 32MB cards kicking around. All were formatted to FAT (not FAT32, not that that size would allow it) but none of the would work. I nicked a 512MB from a camera and had instant success. That is why there are two simular cards in the photo, they are the only two that seem to operate. Pullups didn't change anything.

Clusso is right, knock up a simple PropDos/ PropCOMM on a demo board etc get that going, and then change things. 


Style and grace : Nil point

Back to Top
 

Dr_Acula
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2008
Total Posts : 606
 
   Posted 11/4/2009 2:57 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
I am getting closer to the quest for a debug statement.

As I understand it the Main program calls Objects. These might then call sub-objects The main routine defines objects in the "obj" section. A main routine then can use these objects in the form myobject.xxx. So far, so good and all very simple and objects can be used to encapsulate tasks (like printing to a PC terminal program) with a single command. However, these objects only appear to be able to be called from the main program. You can't call them from within other objects?

So, in BASIC, PRINT "Hello World" might call an object PRINT which sends something to the screen. Or perhaps it is easier to describe in C, which uses the printf(). These are commands that you get used to using and they always work. But not, it appears, in spin. These functions only work from the main program.

BUT, I found a clue!! Inside the fsrwFemto_rr001.spin object are calls to a sub-object called ldr. This is not mentioned anywhere in the obj list of the main program. But it does appear in the object list of the sub fsrw object.

SO - in the obj section of the fsrw object I added the uart object:

obj
'
'   The object that provides the block-level access.
'
   ldr    : "sdspiFemto"       ' SPIN program loader and support routines
   UART1     : "FullDuplexSerial_rr004"                   'FDX v1.2 with mods


And then I added this:

pub startSD(ioControl)
   UART1.str (string("Starting SD in fsrwFemto")) ' added code to test where it is up to
   return ldr.start(ioControl)


At least this does not give an error any more from the compiler. It doesn't actually print anything from that sub object, but it is one step in the quest for a PRINT "HELLO" from within an object.

So I think I am getting close to building a simple debugging system. Any help would be very much appreciated.

Addit: @Toby, I'm using 512Mb cards. My task list is to 1) print "Hello" from any nominal line in the spin code (not just from the Main spin code), then 2) trace out the code in the fsrw object to find where it sets /CS low, then 3) find where it sets the Clock and /DO lines low, and test those go out to the correct pins on the SD card, and then 4) add in the pullup resistors and then 5) hopefully read or write a file off the SD card.

Addit addit: More info - I think the above test starting two instances of uart means they will clash. (there was one extra bit of code to start the second uart too). Anyway, I'll leave the quest for debugging statements for the moment in search of actual debugging.


PRI FindSDblock | i, n, r                               'read blockno of file for count into buffer

  r := sd.startSD(@ioControl)                           'start the SD routines


calls this

pub startSD(ioControl)
   return ldr.start(ioControl)


which calls this

PUB start(ctrlBlk) | t                                 '' Start the I2C I/O driver (standalone)
  control := ctrlBlk                                   ''  using address of 2 longs for control
  stop                                                 ' Stop a previous copy
  computeTimes
  long[control][0] := 0                                ' Initialize the control block
  long[control] := 0
  cog := cognew(@i2cEntryPoint,control) + 1            ' Start a new cog with the I2C driver
  return cog > 0                                       ' Indicate success


and printing out the value it returns a value of -1

I tried making cog a nominal value (eg 5) and changing the last line to 'return cog' and it returned the number. But what does the '> 0' mean? And what does the value of -1 mean - is this a fail on the part of starting the sd card access, or is it a fail on the part of finding a spare cog?


www.smarthome.viviti.com/build

Post Edited (Dr_Acula) : 11/4/2009 11:47:16 AM GMT

Back to Top
 

Toby Seckshund
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2009
Total Posts : 477
 
   Posted 11/4/2009 4:06 AM (GMT -8)    Quote This PostAlert An Admin About This Post.

Clusso

Yes, my version of Blade2 is just as your design apart from the jumbled up addr (not A0-A7) and data orders. The SD card's /CE is from the latch so will not require a pullup anyway. The PropCOMM SD is on P0-P3 and has no pullups but I suppose that it would be better to give its /CE one at least.

I'll get a chance to play more tonight, last night was a rework because of my mistake in trying just the one Xtal and having the Blade2 XO driving the PropCOMM's XI. Works on AVRs.


Style and grace : Nil point

Back to Top
 

Cluso99
We live onboard



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2008
Total Posts : 2276
 
   Posted 11/4/2009 4:54 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
James: The return cog >0 returns true or false to the calling routine. If a cog was started then cog will usually be set to the cog number +1. So if cog=0 then no cog was started and a false is returned.

Toby: I know a number of people are not using pullups on CLK, DI, DO lines. Without intimate circuit implementation, resistors are safer. The SD /CS will not require a pullup since the line is always driven by the latch, and the input to the latch has a pullup. RamBlade uses the data lines for CLK, DI & DO. The reason I chose the Address lines on the TriBlade was that I expected the address lines to already be outputs when I designed the card. However, in practice, they are tristated and a different cog drives the sd card lines, so nothing was gained.


Links to other interesting threads:
Back to Top
 

Toby Seckshund
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2009
Total Posts : 477
 
   Posted 11/4/2009 1:36 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Dr_A

I have only just got home, and have left a load of stuff back in the office. The data I used to wire up the full sized SDs was from

http://pinouts.ru/Memory/sdcard_pinout.shtml
http://www.ucontroller.com/documentation/SDCardDoc.html

with the sd card placed so that the gold tabs are facing you at the top, the pins used are the "middle 7" of 9. The one that is displaced by the corner diagonal (9) and the last of the strait ones (8), which is half width, are not used.

1 is /CS
2 is DI data input
3 is VSS
4 is VDD
5 is SCLK
6 is VSS(2)
7 is DO data output

hope that this is what you needed.


Style and grace : Nil point

Back to Top
 

Dr_Acula
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2008
Total Posts : 606
 
   Posted 11/4/2009 3:21 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Hi Toby,

Thanks for the links. The pinouts are all ok, but it looks like I need five pullup resistors. I'm not 100% sure why the pullups are needed on some pins (eg DO), but not having one on pin 8 could be the problem.

@Cluso, I'm getting -1 back from that routine, not 0 or 1, so not sure what is going on there. But I can swap back and forth to the triblade board and debug that by comparing the two.

Cheers, James


www.smarthome.viviti.com/build

Back to Top
 

Cluso99
We live onboard



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2008
Total Posts : 2276
 
   Posted 11/4/2009 7:29 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Drac: -1 means the statement is true. That is, a cog was started because
cog:=cogid+1
and
result := cog > 0 'i.e. if cog > 0 result := true (-1) else result := false (0)

The only catch in spin is that true := -1 and false := not true so false is <> -1

Does this make sense?


Links to other interesting threads:
Back to Top
 

Toby Seckshund
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2009
Total Posts : 477
 
   Posted 11/5/2009 12:03 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
I just commited Propocide. Wrong PSU up the unreg blade2 board. Got a tad warm, along with the EEPROM. Now I'm down to Two.

Do you think that there will a claim under the sale of goods act, after all I only overvolted it by a small factor of 3:1.

I wish I had a cat, something has got to be kicked !


Style and grace : Nil point

Back to Top
 
[ << Previous Thread | Next Thread >> ]
New Topic Post Reply Printable Version
848 posts in this thread.
Viewing Page :
 
 
Forum Information
Currently it is Friday, November 20, 2009 10:39 PM (GMT -8)
There are a total of 393,734 posts in 55,521 threads.
In the last 3 days there were 82 new threads and 700 reply posts. View Active Threads
Who's Online
This forum has 17687 registered members. Please welcome our newest member, mark09.
55 Guest(s), 2 Registered Member(s) are currently online.  Details
Todd Chapman, Sal Ammoniac