Hub RAM - rosco-pc/propeller-wiki GitHub Wiki

Hub RAM is the primary memory of the Propeller chip. It is entirely separate from Cog RAM.

A program running in a Cog (whether a user program or the Propeller Spin Interpreter) has access to the Hub RAM through the use of RDLONG, RDWORD, RDBYTE, WRLONG, WRWORD and WRBYTE instructions. The design of the Propeller is such that all of these instructions are 'atomic', which means that they will always complete in full, never partially, and if two Cogs do write to the same Hub RAM location, the value placed will be that of the last written. The value placed will never be a mix of what both Cogs attempted to write. Use of Locks can be used to prevent non-atomic access to larger areas of Hub RAM.

The Hub RAM may be considered to be 32K x 8 bits, 16K x 16 bits, 8K x 32 bits or in any combination as circumstances dictate. To use RDLONG and WRLONG within a Cog, the address must be on a long boundary (the two LSB's must be zero). To use RDWORD and WRWORD the address must be on a word boundary (the LSB must be zero).

Hub RAM is loaded from an external 32K x 8 bit I2C EEPROM after reset or downloaded into from the Propeller Tool (or other third-party Propeller Bootloader). Once the Hub RAM has been loaded, a Spin Interpreter is loaded into Cog 0 which begins execution of the Spin program which has been loaded.

The external EEPROM and any downloaded program must always contain a Spin program to be executed, even if this is just a small Spin program to place the Propeller in an operating mode other than a Spin interpreter.

This can be better understood when you recall that the Hub RAM does not contain primary machine code executed by the real processor as in conventional microcontrollers. The Hub RAM contains just - data -. The meaning of the data depends on what the real program(s) running in the COG(s) think appropriate. As COG 0 starts with the SPIN interpreter, it is the master to decide.

See alse:

Hub Memory Map