Skip to content

Flash: Implement the remaining subcommands #71

Description

@ETSells

Description

Legacy SDEC (pre-v2) provided interfaces for a series of commands to interact with the flight computer's flash chip. v2 has implemented the most important subcommand, but there are others that still need to be implemented. These are:

  1. flash erase (this one is the only "need to have" -- the rest will likely go unused but are still a good exercise)
  2. flash read
  3. flash write
  4. flash enable
  5. flash disable

The subcommand opcodes for these are provided in the FLASH_SUBCMD_CODE in driver/flash.h.

/* Flash subcommand codes */
typedef enum FLASH_SUBCMD_CODES 
	{
	FLASH_SUBCMD_READ = 0,
	FLASH_SUBCMD_ENABLE  ,
	FLASH_SUBCMD_DISABLE ,
	FLASH_SUBCMD_WRITE   ,
	FLASH_SUBCMD_ERASE   ,
	FLASH_SUBCMD_STATUS  ,
	FLASH_SUBCMD_EXTRACT ,
	FLASH_SUBCMD_HS_READ ,
	FLASH_SUBCMD_4K_ERASE
	} FLASH_SUBCMD_CODE;

EDIT: I'm realizing now that these were done very weirdly. The subcommand code is packed into the three most significant bits of the byte that you send. You'll need to take this value from the enum and left-shift it 5x. This makes the true subcommand codes:

Read = 0
Enable = 32 = 0x20
Disable = 64 = 0x40
Write = 96 = 0x60
Erase = 128 = 0x80

The expected flow for a terminal command is to send the command opcode (1 byte -- in this case, it's 0x22), and then the subcommand opcode (1 byte, defined above). You will need to pass a SerialObj to the function that implements each subcommand, and implement one function for each command.

In addition, SDECv2 does not yet have a great place for generic commands like this that don't require parser objects. We'll want to make a new module in SDECv2 to support these. Consider naming this folder "Commands" and create a python file for the flash subcommands within.

Once the commands are implemented, they will need to be added to SDEC-CLI. The flash command already exists, so hopefully it won't be too bad to add each subcommand to the list.

I am assigning this issue to both of you to pair program and/or split up to subtasks however you want. My recommendation is for @Ljmeza95 to create the new module, and for the two of you to split the five subcommands listed above between you.

Points of Contact

Fmr. SDEC Lead: @journeyhancock (depending on availability for questions)
Flight Computer Rev. 2 Project Lead: @NArmistead
Flash SME: @ETSells

Metadata

Metadata

Labels

Projects

Status
In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions