Quantcast
Channel: Recent Discussions — Parallax Forums
Viewing all 18780 articles
Browse latest View live

TACHYON O/S - Furiously Fast Forth, compact bytecode, interactive, FAT32+LAN+VGA+more

$
0
0
Updated links 150826
Propeller Hardware Explorer with VGA
Tachyon Dropbox files and binaries (latest)
Introduction to TACHYON Forth
Tachyon Forth Resource Links
Tachyon Web Server
FTP: ftp://tachyonforth.com
Telnet: tachyonforth.com 10001

Watch Easynet in operation
image



Note: these early posts are mostly historical only, please read the latest posts or click the links in my sig.
Enhanced bitmap graphics demo + serial
image

*ORIGINAL POST*

I've been hooked onto Forth again after a long break away. Thanks to Sal's PropForth and recently the Bluetooth modules I have rediscovered the advantages and fun of programming and testing in a Forth environment. Now I mentioned I have been away from Forth for awhile and that's got to do with the Propeller chip since I like using it but Forth does not lend itself to this architecture very easily. Several years ago (time flies) I had a look at writing a Forth call CogForth for the Prop but I just felt it was too much hard work, which it was, not just because of the architecture but also because of the limitations of the tools (Spin tool etc). Even so the Forth would have been slow for what I need and there were memory limitations.

However, spurred on by the efforts of Sal Sanci and Prop Braino I have taken another look at my old CogForth since I needed amongst other things more runtime speed without having to resort to assembler. So over the last couple of days CogForth has been completely revamped and I think I'm on a winner with this implementation. It is both fast and very small thanks to the byte codes for each Forth VM operation. Like a tachyon, it is fast and very small (as a hypothetical particle anyway) with emphasis on fast I/O operations and maximizing the Propeller's memory. What would some byte code look like? Have a look at this function which prints a hex character:
0534(001C)             | PRTHEX  ' ( n -- ) print n (0..$0F) as a hex character
0534(001C) 2D          |         byte  CLIT/2,$30,PLUS/2
0535(001C) 30          | 
0536(001C) 0C          | 
0537(001C) 05          |         byte  DUP/2,CLIT/2,$39,GT/2,_IF/2,3
0538(001D) 2D          | 
0539(001D) 39          | 
053A(001D) 20          | 
053B(001D) 3E          | 
053C(001E) 03          | 
053D(001E) 2D          |         byte  CLIT/2,12,PLUS/2                      'Adjust for A..F
053E(001E) 0C          | 
053F(001E) 0C          | 
0540(001F) 49          | PRTCH   byte  EMIT/2,EXIT/2
0541(001F) 00          | 
EDIT: Byte codes mush be shifted one bit right to compress 9-bits, the lsb is always zero as all byte code functions are on double-long boundaries.

So you see this function takes 14 bytes and compare this to Spin which also uses byte codes:
88                        char+=$30
Addr : 05B0:          38 30  : Constant 1 Bytes - 30 - $00000030 48
Addr : 05B2:          66 4C  : Variable Operation Local Offset - 1 Assign WordMathop +
89                        if char > $39
Addr : 05B4:             64  : Variable Operation Local Offset - 1 Read
Addr : 05B5:          38 39  : Constant 1 Bytes - 39 - $00000039 57
Addr : 05B7:             FA  : Math Op >     
Addr : 05B8: JZ Label0002
Addr : 05B8:          0A 04  : jz Address = 05BE 4
90                          char+=12
Addr : 05BA:          38 0C  : Constant 1 Bytes - 0C - $0000000C 12
Addr : 05BC:          66 4C  : Variable Operation Local Offset - 1 Assign WordMathop +
Addr : 05BE: Label0002
Addr : 05BE: Label0003
91                        coms.tx(char)
Addr : 05BE:             01  : Drop Anchor   
Addr : 05BF:             64  : Variable Operation Local Offset - 1 Read
Addr : 05C0:       06 03 0B  : Call Obj.Sub 3 11
Addr : 05C3:             32  : Return

<removed proposed dictionary description>

The runtime speed is mainly because many of the primitives are written in assembly and stacks are implemented that are more suited for the Prop's architecture permitting direct addressing, just like a register. So many of the primitives get the job done with very very few instructions and even the runtime interpreter is lean and mean. A byte code is read from hub RAM and shifted up to 9-bits which the Prop jumps to in COG memory, so it's very direct. The runtime interpreter looks like this:
doNEXT                  rdbyte  token,IP                'read byte code instruction
                        add     IP,#1                   'advance IP to next byte token
                        shl     token,#1                'expand to 9-bits - all byte codes point to code on double-long boundary
                        cmp    token,#$180 wc          'tokens $C0..$FF are calls to kernel byte code via kbctbl
               if_c     jmp     token                   'directly execute PASM byte codes without further ado

EDIT: Fixed a bug when testing for PASM for extended byte code functions.

There's a test for byte codes from $C0..$FF which doesn't really impact the speedy operation of the assembly primitves which are indexed by codes $00..$BF. The reason I reserve some codes is that there is no way you could use all the 256 codes for assembly primitives so I used some to form a very compact way of accessing up to 64 more words (functions) which instead of being assembly code are instead interpreted byte codes. All byte code functions other than these special 64 are referenced with 2 or 3 bytes one of which is the byte code and the other 1 or 2 bytes are a relative address poining back to the word function. The one byte CALL gets straight into 1 of 64 higher-level functions which are themselves comprised of byte codes which eventually execute assembly code via the first 192 byte codes $00..$BF.

Anyway, I'm developing and testing and the beta will be ready very soon but I thought I would present some details of the workings of this Forth implementation as I am also looking for feedback. Perhaps also someone could suggest an easier way around the Spin/BST compiler limitations especially with DAT sections and references which the compiler insists must be on long boundaries. Anyway, I want the references to be absolute in hub RAM rather than as if it were PASM running in a COG. Also, I am making it far easier to interface to various chips by having low-level code for serial operations and making all the byte code operations fast, especially serial operations. I'm even thinking of making it as easy to use as the Basic Stamp. For instance, there's something in being able to send and receive serial data on any pin at any time (without starting up a cog). So too all those pin high and pin low and clocking operations etc. I want to be able to hook-up an I2C or SPI'ish chip and bit-bash to it at least in the 100kHz range if not more (without resorting to PASM in a COG).

This is my header file and some code snippets for the moment.


TACHYON

A very fast and very small Forth byte code interpreter for the Propeller chip.
2012 Peter Jakacki

Features:
- Low level words are written in PASM and accessed by the
Forth run-time interpreter as single byte codes.
Byte codes are read from hub RAM and executed in PASM
Byte codes $00..$BF are PASM primitives expaned to 9-bits to directly address COG code
Byte codes $C0..$FF are calls to kernel byte code defs via table in hub RAM

- Support for LMM operations
- Interpreted byte code definitions are referenced either as:
- 1 byte - codes $C0..$FF index their definitions via a table - used as part of compiled kernel
- 2 bytes - RCALL opcode + relative byte (always referenced backwards) (extra 4 bits in opcode = -4096 range)
There are 16 entires in the COG for the RCALL byte code + extra address bits
- 3 bytes - WCALL byte code + 16-bit relative address
- All literals and strings are byte aligned
- Fast I/O bit-bashing support
- Flexible SPI PASM code support words in kernel
Constuct fast serial drivers with minimal code


- Holds Forth headers in EEPROM or SD storage
Searches the dictionary using rapid index key searching by first character
No hub RAM is used by headers
Even 32K EEPROMs can be used if the area is in RAM is normally rewritten (i.e. video memory)
Option to hold additional information per defintion such as stack usage and description

- Kernel compiled in standard manner via Spin tools so other Spin objects can be combined

- Three stacks in COG RAM: Data, Return, and Loop
Access loop indices outside of definitions
Avoids manipulation and corruption of return stack
Static stack arrays for direct addressing of stack items
Intrinsically safe stack overflow and underflow

Some early unoptimized observations:
- Empty loops can execute in 500ns to 825ns (absolute worst case)
Two to one stack operations ( + * AND etc) inc opcode fetch take 900ns to 1.087us (absolute worse case)
' Fetch the next byte code instruction pointed to by the instruction pointer IP in hub RAM
'
doNEXT                  rdbyte  token,IP                'read byte code instruction
                        add     IP,#1                   'advance IP to next byte token
                        shl     token,#1                'expand to 9-bits - all byte codes point to code on double-long boundary
                        cmp    token,#$180 wc          'tokens $C0..$FF are calls to kernel byte code via kbctbl
               if_c     jmp     token                   'directly execute PASM byte codes without further ado
                                                        ' byte codes $C0..$FF point to further byte code definitions
                            ' which are larger fragments of byte code in hub RAM
                        call    #SAVEIP                 'save current IP in prep for a call
                        add     X,kbcptr                'kbcptr points to the kernel byte code table (less $180)
                        rdword  IP,X                    'read 16-bit address from hub kbc table into IP
                        jmp     #doNEXT                 'Execute the code
  
  
' Example of PASM code entries for Byte Code indexing on double-long boundaries
'   
DROP2                   call    #POPX
                        jmp     #DROP
DUP                     mov     X,tos                   ' Read directly from the top of the data stack
                        jmp     #PUSHX                  ' Push X onto the data stack and doNEXT              '
OVER                    mov     X,tos+1                 'read second data item and push
                        jmp     #PUSHX
NIP                     mov     tos+1,tos               'replace second item with top and drop
                        jmp     #DROP

LIT0                    mov     X,#0
                        jmp     #PUSHX
LIT1                    mov     X,#1
                        jmp     #PUSHX

'****************** BOOLEAN ******************
_AND                    movi    _POPEX,#1000_001    ' AND ( n1 n2 -- n3 )
                        jmp     #POPEX                  'discard top of stack and execute modified PASM
_OR                     movi    _POPEX,#1010_001
                        jmp     #POPEX
_XOR                    movi    _POPEX,#1011_001
                        jmp     #POPEX

'***************** MEMORY *******************
CFETCH                  rdbyte  tos,tos        ' read byte pointed to by tos into tos
                        jmp     #doNEXT    
CPLUSST                 rdbyte  X,tos           ' read in byte from adress
                        add     tos+1,X         ' add second item to contents of address 
CSTORE                  wrbyte  tos+1,tos       ' write the second item using address on the tos
                        jmp     #DROP2


' Example of interpreted byte codes in hub RAM
' References to other byte code defintions is relative which is also necessary because of the Spin compiler's limitations with DAT sections
'
0530(001B) 06          | _BOUNDS byte  OVER/2,PLUS/2,SWAP/2,EXIT/2
0531(001B) 0C          | 
0532(001B) 08          | 
0533(001B) 00          | 
0534(001C)             | PRTHEX  ' ( n -- ) print n (0..$0F) as a hex character
0534(001C) 2D          |         byte  CLIT/2,$30,PLUS/2
0535(001C) 30          | 
0536(001C) 0C          | 
0537(001C) 05          |         byte  DUP/2,CLIT/2,$39,GT/2,_IF/2,3
0538(001D) 2D          | 
0539(001D) 39          | 
053A(001D) 20          | 
053B(001D) 3E          | 
053C(001E) 03          | 
053D(001E) 2D          |         byte  CLIT/2,12,PLUS/2                      'Adjust for A..F
053E(001E) 0C          | 
053F(001E) 0C          | 
0540(001F) 49          | PRTCH   byte  EMIT/2,EXIT/2
0541(001F) 00          | 
0542(001F)             | PRTBYTE
0542(001F) 05          |         byte  DUP/2,CLIT/2,4,_SHR/2
0543(001F) 2D          | 
0544(0020) 04          | 
0545(0020) 1A          | 
0546(0020) 3B          |         byte  RCALL/2,20 '--&gt;PRTHEX                  'Due to limitations of Spin tool &amp; BST this needs to be calculated by hand
0547(0020) 14          | 
0548(0021) 3B          |         byte  RCALL/2,22
0549(0021) 16          | 
054A(0021) 00          |         byte  EXIT/2
EDIT: Fixed byte code references which are encoded as 8-bits using cogaddress/2

Propeller 1-2-3 FPGA Board (#60054) available to Forum Members $375

$
0
0
Hello there, 
We've got 30 Propeller 1-2-3 FPGA Boards (#60054) in stock, built around the Cyclone V A-7. As Chip has announced that we will be making a new version of this board with the Cyclone V A-9, we'd like to do a quick sale of the #60054 boards to Propeller developers (you). We are not offering these for general sale like our common products because we would like to uphold a certain standard with documentation, schematics, code and support for products sold on the web site. Instead, all the resources available for these boards will be posted on this page and PayPal will be the payment choice. The resources we will share include a schematic, a Propeller loader from Chip, and the production files. We're providing Altium production files because the board is open source, but also because some customers have designed products using the Propeller 2 binary image and we want them to have freedom to proceed with any PCB design and production plans should Parallax have further Propeller 2 ASIC delays.   
In summary, the support for this product is right here on the forums. PayPal ebaysales@parallax.com $375 and we'll ship you a board (shipping is included). I will be updating this post with the relevant links around this effort (or, I'll get a helper to do that because I'm upside down time-wise).
This is what you can do with the Propeller 1-2-3 FPGA Board with the Cyclone A-7:[*]Run the Propeller 1 in full, even up to 48 cogs (forum members will know something about this);[*]Run the first Propeller 2 binary image released a year ago;[*]Run future versions of Propeller 2 (with limitations; we're not sure exactly how many yet).[/list]Resources (to be updated): Thanks, 
Ken Gracey

Propsynth D - a 6 voice polyphonic synth with Propeller chip

GCC VGA Demo debugging

$
0
0
For a larger project, I'm trying to get a feeling for VGA output and am poking around in several of the VGA Demo's in the SimpleIDE package.

I'm running into the following problem:
Compiling and uploading the \Propeller GCC Demos\pong\pong.side project, I get a Pong game (that seems to restart at arbitrary moments) so I know that at least the connection is OK.

Compiling and uploading the \Propeller GCC Demos\vgademo\vgademo.side project, I get no errors, but the screen insists there is no VGA signal.
The line 'VgaStart(2, 30, (int *)tilemap, tiles, &pixelColors, (int *)&syncIndicator);' appears to set the VGA pin-group to '2'. This is the same setting I had to use for the pong game, which worked.

I'm using an old Propeller Proto USB board Rev A.
This board offers a VGA connector at pin 16 and up. (This is why it makes sense that pingroup 2 should work..? )

Does anybody have any experience with the vgademo project and / or any idea how I could debug this? I've tried adding print's to the code, (after adding simpleterm.h even appeared to succeed at this) but even a pause and terminalwrite at the beginning of my main doesn't appear to do anything.

While writing this, I'm digging through the settings and one thing I do notice, is that memtype is:
>memtype=xmmc external flash code main ram data

Doesn't this mean that I have to attach extra RAM to my board / a board called 'BOARD::C3F' has this external RAM? If so, I might well have solved my own problem.... ^_^
Can anybody verify this for me?

How do variable affect objects?

$
0
0
Hello,

I'm trying my hand at coding objects for the first time. As a starting point I used some code from the tutorial in the prop manual v1.0. The goal is an object: "monitor" that will do serial output:
VAR
  long Stack [9]
  long delay
  long time
  byte Cog

PUB  Start (Pin, Baud, Data): Success
  Stop
  Success := (Cog:= cognew(Ser (Pin, Baud, Data), @Stack) +1)

Pub Stop

  if Cog                        ' any value greater than 0 must be true
    cogstop(Cog~ -1)
 
Pub Ser (Pin, Baud, Data)

  dira[Pin]~~
  delay := ( clkfreq / Baud )
  Data <-= ( Pin + 1 )          'Rotates MSB left until it is at  correct Pin for OUTA
  time :=cnt                       
  repeat
    repeat 4
      outa[Pin]~~                  'output a start bit  of each byte
     waitcnt (time += delay)
      repeat 8
        outa:= !Data
        Data <-= 1
        waitcnt (time +=delay)
      outa[Pin]~
      waitcnt(time+= delay)      'output 2 stop bits between bytes of data
      waitcnt(time += delay)
    waitcnt( time += delay*50)

When I call the ser(pin,baud,data) method from another object:
OBJ
  sout : "monitor"

PUB main

  sout.ser(17,9600, 25)
  repeat
.... it works fine.
However, when I attempt to call it from the start method and use another cog:
sout.start(17,9600, 25)
....it fails.

However, if I eliminate the global variables 'time' & 'delay' from the 'ser' method and just fudge in some numbers then everything works as expected. Is there something funny in how I'm using the variable or is that a red herring?

Thanks for any suggestions.

mo

Looking for a game dev system

$
0
0
Hi,

I am looking for a game dev system. Just a hobby so I can pick a micro or pc and I pick micro. I need some input to see where to go next. Sorry if I got the wrong forum. I have a few Propellers already so this seemed to be the place to go.

Part of the question is if I even need another system. I currently have a Propeller USB + El Jugador (2 SNES controller ports) and a QuickStart + QuickPlayer (for 2 WII Nunchuk ports). Both work fine and I like the Propeller. Really, I don't need another but this is a hobby! (I also have OBC's PMC.)

I have looked over the Hydra on the current www.ic0nstrux.com web site. It is older but I like the complete package. If I specifically want to do games, the Hydra seems to be the right one of their many offerings.

I have looked at the Uzebox kit from Adafruit. Seems to have a good following right now. And it gives me a reason to fire up the soldering iron. Big plus there.

Questions then become:
1. Can I do anything with a Hydra or Uzebox that I can't do with the El Jugador or QuickPlayer?
2. Is the Hydra just too old to be a viable purchase in 2016?
3. Switch to Uzebox?
4. Any other alternatives I should look at?

Thanks a lot for any comments or opinions. I just need a little input from others before I spend more money on micros.

Rick

Artificial neural net on a prop?

$
0
0
Hey all,

Ive been gone a while, putting software on hold while I'm working on a robot base for my next propeller project. I'm working on a simple walking bugbot with a "peripheral nervous system" that would handle basic functions, like moving the legs correctly, to leave higher-level functions to be handled by a prop/other mcu, like deciding where to go, in a horse-and-rider configuration. If you're interested I'm using BEAM nervous nets for those low-level functions.

Anyway, I'm still not done with the base (I thoroughly melted a micro servo the other day trying to solder a five-wire cable onto the motor and potentiometer leads lol) but once I've gotten it working the ultimate goal was to have a prop brain controlling it, which might be able to learn or at least give it some kind of bug-like intelligence. Which brings me to my question here... has anyone tried making a neural net on the propeller? I don't mean a feedforward perceptron chain, I mean an actual, biologically-inspired spiking neural net with feedback and connections between neurons that can be individually strengthened or weakened...

Has anyone attempted something like this? I saw humanoido's horribly expensive big brain thing, but did anyone actually program the beast? Has anyone made a neural net, regardless of type, actually run on the prop?

Thanks everyone!!!ļ

:D

Upgrade Path For Elev-8 V2 Owners

$
0
0
I like some of the features that have been incorporated into the V3 Elev-8, in particular the higher performance motors. But I'm disappointed that Parallax didn't provide an upgrade path for those of us who have V2 ships. I have two Elev-8 V2 ships and I'm happy with them, but would like to improve their flight endurance time. I would like to replace my KA20-20L 1050 KV motors with the KEDA 1000 kV, or something similar. But I have to determine if I need to replace my ESCs as well or is there some compelling reason to replace them??

Also, I need to fabricate a motor mount that will accommodate the new motor but can fit on my V2 booms using the existing holes. If anyone has a solution, I'd love to hear from you; if I come up with one first, I'll share it here.

Help choosing high accuracy motor, maybe a hard drive servo??

$
0
0
I have some sensors and mirrors I need to mount to a motor to do 180 degree or 360 degree sweeps depending on how things end up. Since these motors are just rotating sensors they don't need to have to much torque or gearing. What they do need to do is be integrated with a very hi res encoder and be able to have precise control to stop on a trick with no backlash! I have a few encoders with a few thousand counts which are what I planed on using.

I have a stock pile of motors from hard drives, I have never used them but would imagine these things would have to be precise and backlash free? Maybe there is a better solution, Im not sure what advantages brush less motors have.

LM34 Issues

$
0
0
I don't know where to start with my LM34 Sensor, and anything I have found on forums, the powerpoint, or on other websites does not seem to assist with my issues.

We are in BASIC Editor using BS2, and we have the language to 2.5.

I do have a code that I thought might work that ended up not helping:
// LM34 temp sensor connected to analog pin A0
const int tempSensor = A0;

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println(analogRead(tempSensor), DEC);
delay(300);
}

$13.50 Drone... Free Ship

$
0
0
You can't say no now... and this cheapie actually has advanced features (see end). At that price, you can afford to destroy one daily.

http://www.ebay.com/itm/Eachine-H8-Mini-RC-Quadcopter-Drone-Headless-Mode-2-4G-4CH-6-Axis-Gyro-RTF-Black-/281815290749

from http://uavcoach.com/cheap-drones-for-beginners/

The Eachine H8 Mini is the World’s cheapest quadcopter to date. Sitting at the rock-bottom price of $13.99, this quad still comes with a fair amount of advanced features.

Most notably, it’s got one-press automatic return. A single push of a button brings the drone flying back to you. With Headless Mode, you don’t need to adjust the quad’s position before flying, and the H8 Mini offers 360 degree rolling.

While it’s not the best drone out there, you’ll be hard pressed to find one with this price-to-features ratio.

Nokia 6600 cmos camera with an arduino board

$
0
0
hello everyone , i am making a self balancing robot and i decided to use an old Nokia 6600 cmos camera tha i have but i really didn't figure out how to connect this camera and use it with my arduino uno
can anyone please help me

The P8X Game System

$
0
0
Hello,

I present you the project I'm working on for quite some time: the P8X Game System, a dual-propeller based game console. It is a combination of an hardware platform and an open source integrated development environment based on propellergcc aimed at developing retro-style games.

The libraries currently supports a number of video modes, including PAL, NTSC and VGA at various resolutions, up to 320x240 pixels, with 4 or 16 colors per pixel, RGB+sync only.
I'm attaching some images of the console prototype, schematics and IDE screenshot, so you can have a taste of what it is already done.

I have also setup a web site with more details, source code and downloads:
https://dev.maccasoft.com/propgame

I would appreciate comments and suggestions.

Have fun!
Marco

Plywood Arlo

$
0
0
I bought one of the Parallax wheel & motor kits when they went on sale, figuring it'd be fun to try doing something like a big Scribbler.

I built a platform for it yesterday from the Arlo design, but stretched it a little. The deck is plywood, and the tail-dragger is a ping-pong ball. No brains yet, but this is a first test just driving it around with a remote.

image

How to learn Pasm equivalent of Spin?

$
0
0
I hit a wall with my current project. I wrote Spin code that does one of three things individually:
Wirelessly control two DC motors differentially, four servos for an arm or two servos for a pan/tilt camera.
I can't do all three in the same object because of the overhead.
This means I'll have to learn to write equivalent code in assembly.
Can anyone recommend a good place to start?

Faster communications between cogs???

$
0
0
On numerous occasions I have not been able to achieve something on the P1 because I could not get data between cogs quick enough.

Others, including myself, have said it was a shame the Port B had not been implemented internally so we could use these 32-bits to communicate between cogs.

In the P2Hot we had a bus between cogs plus instructions to assist. But this is not in the P2.

I have been playing with USB LS again in the P1. There are all sorts of tricks to read the USB LS bus. Let me explain where I am up to..

Each USB LS bit comes in at precisely every 64 clocks when overclocking P1 to 96MHz. This means 16 instructions for most instructions. Here is a sample piece of code for a LS bit time...
rxbit         test      state_k, ina   wz       '4 04   z=J/SE0 nz=K/SE1        | nc | SE0 | SE1 |
              test      state_jk,ina   wc       '4 08   c=J/K   nc=SE0/SE1      | c  |  J  |  K  |
        if_nc jmp       #SE0_SE1                '4 12   j if SE0(EOP)/SE1(error)
              muxz      prev, bit30    wc       '4 16   c=!current bit (prev^current) (c=1=clock="0"bit)
              shl       prev, #1                '4 20   shift current J/K into previous J/K
              rcr       data, #1                '4 24   collect inverse data bit (lsb first)
              test      crc, #1        wz       '4 28   z=crc[0] & c=!current; now accum crc..
 if_nc_and_z  xor       crc, poly               '4 32   if  !curr=1 & crc[0]=0 then crc=crc^poly     ????
 if_c_and_nz  xor       crc, poly               '4 36   +if !curr=0 & crc[0]=1 then crc=crc^poly     ????
              shr       crc, #1                 '4 40   crc>>1
              rcr       stuffcount, #6 wz       '4 44   z=(6x1's) so unstuff next
        if_z  call      #rxunstuff              '4 48   unstuff next bit
              nop                               '4 52
              nop                               '4 56
              nop                               '4 60
              nop                               '4 64
rxbit         test      state_k, ina   wz       '4 04   z=J/SE0 nz=K/SE1        | nc | SE0 | SE1 |
              test      state_jk,ina   wc       '4 08   c=J/K   nc=SE0/SE1      | c  |  J  |  K  |
        if_nc jmp       #SE0_SE1                '4 12   j if SE0(EOP)/SE1(error)
              muxz      prev, bit30    wc       '4 16   c=!current bit (prev^current) (c=1=clock="0"bit)
              shl       prev, #1                '4 20   shift current J/K into previous J/K
              rcr       data, #1                '4 24   collect inverse data bit (lsb first)
              test      crc, #1        wz       '4 28   z=crc[0] & c=!current; now accum crc..
 if_nc_and_z  xor       crc, poly               '4 32   if  !curr=1 & crc[0]=0 then crc=crc^poly     ????
 if_c_and_nz  xor       crc, poly               '4 36   +if !curr=0 & crc[0]=1 then crc=crc^poly     ????
              shr       crc, #1                 '4 40   crc>>1
              rcr       stuffcount, #6 wz       '4 44   z=(6x1's) so unstuff next
        if_z  call      #rxunstuff              '4 48   unstuff next bit
              nop                               '4 52
              nop                               '4 56
              nop                               '4 60
              nop                               '4 64

Now, if you unravel 8 bits, then there are 4 usable nop instructions (16 clocks) in which to process the received bit. So there is time to use waitcnt (7+ clocks) with a jmp/djnz (4 clocks to loop, 8 clocks if jump not taken).

However, once 8 bits have been assembled, you must pass this character to another cog for processing, while the code goes back to get the next character.

This is where the problem arises as there are only 4 instructions or 16 clocks in which to write the byte to a hub buffer. To write to hub takes from 8-16 clocks. BUT we don't know where the hub is up to, so the hub write is INDETERMINATE. We don't have the time to use a WAITCNT to resynchronise either.

To get around this problem I stole 10 I/O pins to pass the data byte to the assisting cog. 8 bits are for the data byte, 1 bit is used if the byte is a control character (SYN/EOP/etc), and the last bit is used to signal a byte is available. Of course this is unsatisfactory in a production environment because there aren't normally 10 spare I/O on a P1 circuit.

P2

Chip has implemented the USB serial in the smart pins which will improve timing dramatically. USB is a special case.

The P2 instructions will be 2x faster, the clock will be 2x faster (160+MHz) so that makes it basically 4x faster than the P1. But USB FS is 8x faster than USB LS (12MHz vs 1.5MHz). And then we are overclocking the P1. Will the P2 achieve 192MHz ??? If so, then without the smart pins we are >2x slower to do USB FS 12MHz.

Where am I going with this?
Well, the P2 has lots of cogs to do processing I/O. Smart Pins will help in many, but not all, situations. The cogs are only half the speed of the P2Hot (an accepted reality).

How can we get cogs to co-operate better without overcomplicating the current design? <ducks for cover>

Suggestion

Might it be possible to place a unidirectional latch between each adjacent cog? <ducks for more cover>

Here is the idea..


P2_cog_cog2.jpg

Each cog has a 9 bit internal output latch joined to the next adjacent cog as an input latch. An additional latch bit is set when the latch is written by the cog, and is cleared when the adjacent cog+1 reads the latched 9bit data.

Additional instructions required...

WRCOG D/# [WC,WZ]

Writes the 9 bit D/# data to the latch (to COG+1) and sets the DataAvailable latch (depends on WC/WZ setting below).
If WC is specified, then if the DataAvailable latch is already set (ie the next cog has not read the data) then the data will NOT be written and the C flag will be set.
If WZ is specified, then bit8 of the latch will be masked OFF, irrespective of bit8 in D/#.

RDCOG D [WC,WZ]

Reads the 9 bit data from the latch (from COG-1) and clears the DataAvailable latch (depends on WC/WZ setting below)
If WC is specified, C will be set if the DataAvailable latch was previously set (ie data is valid).
If WZ is specified, then bit8 of the latch read will be masked OFF, and Z will be set to the original bit8 value.

Dare I ask if this is possible and easy to do???

Smartpin "Quadrature Encoder" mode returns erratic values

$
0
0
Chip
I been experiencing weird behaviour of the smartpins in quad. enc mode.
At first I thought it might be faulty encoders, so I replaced them.
The issue persisted so I have removed them and implemented fake ecoders in another cog.
The issue remained so I did a few tests and found that the issue seems to be related to the period between PINGETZ instructions.
in the included code the fake encoder cycles back and forth at low speed and displays the Z value spaced by its lower bits.

If the WAITX instruction @ main is enabled the following output is returned (Correct).
                       00001862
                       0000185A
                      00001856
                    0000184E
                  00001846
                 00001842
               0000183A
             00001832
           0000182A
          00001826
        0000181E
      00001816
     00001812
       0000181A
         00001822
          00001826
            0000182E
              00001836
               0000183A
                 00001842
                   0000184A
                     00001852
                      00001856
                        0000185E
                          00001866
When the WAITX @ main is removed erratic behaviour is observed.
 00000000
                0000023E
                 00000242
                   0000024A
                     00000252
 00000000
                        0000025E
 00000000
                            0000026E
                             00000272
                               0000027A
                                 00000282
 00000000
                              00000276
 00000000
                          00000266
                         00000262
                       0000025A
                     00000252
 00000000
                  00000246
 00000000
              00000236
             00000232
           0000022A

The results vary on each download.
The test code has been running on a P123-A9 board.




PropGCC on P1V with 2MB of hub visible RAM and now 8MB of SDRAM

$
0
0
Hi all,
was wondering if anyone has done anything like this before (perhaps I'm the first to try to go down this path) -

I now have built myself a P1V setup with 2MB of hub SRAM on an MAX10 FPGA.   I have made modifications to the P1V verilog and can access this extra RAM directly via the hub from both SPIN and COG PASM at full hub speed from each COG.  It appears from $10000-$1FFFFF and works perfectly well with RDLONG/WRLONG when reading/writing in this address range.

I am now trying to get PropGCC code to run on it using the LMM model even though I have more than 32kB of HUB RAM.  I don't intend to use any cache driver with the XMM model because of the additional unnecessary penalty involved.  I've downloaded/installed PropGCC on Ubuntu and got the basic fibo demo loaded and working on my setup but that only uses the lower 32kB by design.  I'm also still trying to learn more about PropGCC.

So I am guessing I have to do something like this...

1) modify a linker script somewhere to make the LMM mode make use of this external hub RAM (but where ? I only see XMM linker scripts)
2) use an SD card to hold my PropGCC programs and somehow get the files onto this SD card, using propeller-load tool perhaps.
3) figure out a way to boot my large C LMM programs and run them  - I'm imagining I need to develop some sort of initialization boot code that can be loaded in the low 32kB hub RAM when the Prop boots and then have a way to load more code into higher hub RAM from the SD card like some basic OS would do but there might be alternatives or PropGCC may be able to do some of this work for me... TBD.

Has anyone done anything similar or used PropGCC like this and have ideas of what else I might need to do, or sees other issues here?  Are there lots of 32kB dependencies in PropGCC for LMM code generation?

Cheers,
Roger.


Ultra Wide Band - Location Within an Inch

$
0
0
image

The whole story is here at IEEE Spectrum from a company called 5D Robotics.

ActivityBot HD44780 PCF8574 i2c lcd text not displaying

$
0
0
Hi
I connected HD44780 lcd via PCF8574T and I'm trying to send some text to display but it's not workig.
I can manage display (trun on/off backlight, set cursor), but when I'm sending text nothing happens.
I found libraries with description that it should work but it's not.
My code
#include "i2ceasy.h"
#include "simpletools.h"
#include "i2clcd.h"

i2ceasy *i2cbus;
i2clcd *lcd2004;

int main()
{
i2cbus = i2c__init(4, 5); // SCL pin, SDA pin

lcd2004 = lcd_init(0x27, 2, 16);
lcd_backlightOn();
lcd_setCursor(0, 0);
lcd_print("Text line 1");
lcd_setCursor(1, 0);
lcd_print("Text line 2");
pause(5000);
lcd_backlightOff();

}

I tried this display on arduino and it's working fine.
Viewing all 18780 articles
Browse latest View live