EIR-OPS-018: Rewrite CPLD Firmware
Objective
To write firmware to the GMOD CPLD.
Introduction
Using this procedure, the Operator will write a new firmware image to the GMOD CPLD.
Procedure
This procedure has the following subsections:
Note
A communication window is required for all steps in Sections B - E of this procedure.
A. Pre-pass Preparations
A.1.
Prior to the first pass in which Section B is followed, the Operators must ensure they have access to:
The CPLD image to be uplinked (needed for Steps A.2 and B.6),
An MD5 checksum for this image (Step C.16), and
The length of the image in rows (Steps B.6, B.8, C.14, C.15 and D.5).
Warning
The image to be uplinked must be located on the same computer as MCS (or at least a file system that MCS can access).
A.2.
Calculate an MD5 checksum for the image to be uplinked using:
certutil -hashfile <file> MD5in a terminal on a windows computer, ormd5 <file>in a terminal on a Mac.
Ensure this checksum matches the checksum from the previous step.
B. Upload New CPLD Firmware to OBC
Important
You are about to send the first TC of this procedure - Have you completed the EIR-OPS-003: Start a Communication Pass procedure? A Communication Pass must be started prior to carrying out the operations planned for the pass. Don’t forget to open and set-up the parameters/actions that will be required before the pass starts!
B.1.
The storage channel on the OBC that is intended for CPLD image uploads is 85 (dec).
Before uplinking this firmware to the spacecraft, assess whether the storage channel you intend to fill is empty. To do this:
Querythe parametercore.storage.channelContentwithParameter index in block= 85 (dec).
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
|
Data Size |
2 bytes |
Data Info |
The ChID of storage channel |
Allowed Value(s) |
0001 - FFFF (Hex) |
Expected Value(s) |
85 (dec) |
TM Details |
|
Data Expected from TC |
|
Data Size |
2 bytes |
Data Info |
The number of rows of data in ChID |
Allowed Value(s) |
0000 - FFFF (Hex) |
B.2.
If 0 is returned from the previous step, the Operator can now proceed to Step B.4.
Else, data is already occupying this storage channel. Therefore:
The Operator should now consult with the Software Engineer to confirm it is ok to wipe this data from the channel.
If the Software Engineer gives permission, the Operator should
Invokethe actioncore.storage.Wipewith action argument = 85 (dec).
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
|
Data Size |
2 bytes |
Data Info |
The ID of the storage channel you wish to wipe |
Allowed Value(s) |
0001 - FFFF (Hex) |
Expected Value(s) |
85 (dec) |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
B.3.
Querythe parametercore.storage.channelContentwithParameter index in block= 85 (dec).Confirm 0 (rows) is returned to confirm the wipe was successful.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
|
Data Size |
2 bytes |
Data Info |
The ChID of storage channel |
Allowed Value(s) |
0001 - FFFF (Hex) |
Expected Value(s) |
85 (dec) |
TM Details |
|
Data Expected from TC |
|
Data Size |
2 bytes |
Data Info |
The number of rows of data in ChID |
Allowed Value(s) |
0000 - FFFF (Hex) |
Expected Value |
0000 |
B.4.
Setthe parametercore.storage.rowLengthto 41 (dec) withFirst Row=Last Row= 85 (dec).
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
|
Data Size |
4 bytes, 4 bytes, 4 bytes |
Data Info |
The range of ChIDs and row length to set |
Allowed Value(s) |
0 - 87 (dec), 0 - 87 (dec), 00000000 - FFFFFFFF (hex) |
Expected Value(s) |
|
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
B.5.
Confirm the
Setin the previous step with aGet(i.e. confirm the value was set successfully).
B.6.
Important
As you are about to perform a large uplink of data to the spacecraft, ensure that MCS’s Transfer Window is visible to the Operator before proceeding with this step.
The Operator can now
UplinkGMOD’s CPLD image to the OBC flash channel using the parametercore.storage.channelContent, with:Parameter index in block= 85 (dec),First row= 0,Last row= the length of the image in rows (from Section A) - 1, andResizeticked.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
|
Data Size |
4 bytes , 4 bytes , 4 bytes , many bytes, 1 byte |
Data Info |
The ChID to uplink to, the row range to be written to, the image to uplink, whether the file should be resized into rows |
Allowed Value(s) |
1-87 (dec), 00000000-FFFFFFFF (hex), 00000000-FFFFFFFF (hex), N/A, 0-1 |
Expected Value(s) |
85 (dec), 0, length of the image in rows - 1, binary file from Section A, 1 |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
B.7.
Wait for the Transfer Window on MCS to indicate that the uplink has completed successfully.
Note
Uplinking the image to the spacecraft may require multiple communication passes. At the end of each pass, MCS will automatically ‘Suspend’ the transfer. At the start of each pass, the Operator should ‘Resume’ the transfer after completing the EIR-OPS-003: Start a Communication Pass procedure.
B.8.
Querythe parametercore.storage.channelContentwithParameter index in block= 85 (dec).Ensure the TM returned = the length of the image in rows (from Section A).
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
|
Data Size |
2 bytes |
Data Info |
The ChID of storage channel |
Allowed Value(s) |
0001 - FFFF (Hex) |
Expected Value(s) |
85 (Dec) |
TM Details |
|
Data Expected from TC |
|
Data Size |
2 bytes |
Data Info |
The number of rows of data in ChID |
Allowed Value(s) |
0000 - FFFF (Hex) |
Expected Value |
The length of the image in rows from Section A |
C. Rewrite Preparations
C.1.
Gettheplatform.EPS.actualSwitchStatesparameter, withFirst row= 0 andLast row= 9.Assess the status of rows 2, 5 and 8 of this parameter (i.e. PDMs 3, 6 and 9).
If 1 is returned for these rows/PDMs, the MSP is on.
Warning
PDM 8 (i.e. row 7 of this parameter) is drawing parasitic power. Therefore, when you Get the platform.EPS.actualSwitchStates parameter it will always read as on/1 even when it is powered off.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
Yes |
Data Size |
2 bytes, 2 bytes |
Data Info |
|
Allowed Value(s) |
0-9, 0-9 |
Expected Value(s) |
0, 9 |
TM Details |
|
Data Expected from TC |
|
Data Size |
List[0:9] of Booleans |
Data Info |
SwitchState = 0 (Off), SwitchState = 1 (On) |
Allowed Value(s) |
0 or 1 for each row/PDM |
C.2.
If the above step shows that the MSP is on, proceed to Step C.4.
Else, if one or more of the MSP’s PDMs are powered off,
Invoketheplatform.EPS.TurnOnGMODaction.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
C.3.
To confirm that the MSP is now powered on,
Gettheplatform.EPS.actualSwitchStatesparameter, withFirst row= 0 andLast row= 9.Ensure that rows 2, 5 and 8 of this parameter (i.e. PDMs 3, 6 and 9) now equal 1.
Warning
PDM 8 (i.e. row 7 of this parameter) is drawing parasitic power. Therefore, when you Get the platform.EPS.actualSwitchStates parameter it will always read as on/1 even when it is powered off.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
Yes |
Data Size |
2 bytes, 2 bytes |
Data Info |
|
Allowed Value(s) |
0-9, 0-9 |
Expected Value(s) |
0, 9 |
TM Details |
|
Data Expected from TC |
|
Data Size |
List[0:9] of Booleans |
Data Info |
SwitchState = 0 (Off), SwitchState = 1 (On) |
Allowed Value(s) |
0 or 1 for each switch |
Expected Value(s) |
XX1XX1XX1X (i.e. PDMs 3, 6 and 9 = 1, other PDMs can be 0 or 1) |
C.4.
Getthepayload.GMOD.GMODModeparameter to assess which mode the firmware running on the MSP is operating in.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
|
Data Size |
1 byte |
Data Info |
Payload operational mode |
Allowed Value(s) |
See table below |
Where…
Firmware |
|
Mode |
|---|---|---|
GMOD |
1 |
Idle |
GMOD |
2 |
Experiment |
GMOD |
3 |
CPLD |
GMOD |
4 |
Safe |
C.5.
If the
payload.GMOD.GMODModeparameter indicates that Idle Mode is on-going, skip ahead to Step C.7.Else, now
SettheGMODModeparameter to 1/Idle Mode.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
Yes |
Data Size |
1 byte |
Data Info |
The mode to set EMOD to |
Allowed Value(s) |
0-1 |
Expected Value(s) |
1 |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
C.6.
Confirm the
Setin the previous step with aGet(i.e. confirm the value was set successfully).
Tip
It may take the payload MSP ~tens of seconds to complete the mode change.
C.7.
Gettheplatform.obc.GMODSerial.baudRateParamparameter.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
|
Data Size |
4 bytes |
Data Info |
The baud rate used for GMOD serial communications |
Allowed Value(s) |
00000000 - FFFFFFFF (hex) |
C.8.
If 128000 (dec) was returned in the previous step, the baud rate is already as desired. Therefore, skip ahead to Step C.10.
Else,
Settheplatform.obc.GMODSerial.baudRateParamparameter to 128000 (dec).
Warning
The Operator should be aware of the fact that multiple different SCDB paths are used for this procedure (i.e. payload.GMOD, platform.obc.GMODSerial and payload.FirmwareImageAccess). However, this is not a major concern as it will become obvious if an SCDB is mistaken as the parameter/action will only exist in the correct SCDB path.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
Yes |
Data Size |
4 bytes |
Data Info |
The desired baud rate for GMOD serial communications |
Allowed Value(s) |
00000000 - FFFFFFFF (hex) |
Expected Value(s) |
128000 (dec) |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
C.9.
Confirm the
Setin the previous step with aGet(i.e. confirm the value was set successfully).
C.10.
To programme an image from the OBC onto the CPLD, the desired image must first be loaded from an OBC flash storage channel to a buffer. To start this process, first
Setthepayload.FirmwareImageAccess.ImageStorageChIDparameter to 85 (dec).
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
Yes |
Data Size |
2 bytes |
Data Info |
ID of the storage channel from where the firmware is to be loaded |
Allowed Value(s) |
0000 - FFFF (hex) |
Expected Value(s) |
85 (dec) |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
C.11.
Confirm the
Setin the previous step with aGet(i.e. confirm the value was set successfully).
C.12.
Next
Invokethepayload.FirmwareImageAccess.ClearImageBufferaction to clear any previous data being held in the buffer.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
C.13.
To verify that the buffer is now cleared/empty,
Querythepayload.FirmwareImageAccess.ImageBufferparameter.Ensure that 0 (rows) is returned.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
Rows ( + ACK ) |
Data Size |
2 bytes |
Data Info |
The number of rows of data in the buffer |
Allowed Value(s) |
0000 - FFFF (Hex) |
Expected Value |
0 |
C.14.
Warning
MCS does not allow the Operator to provide a decimal action argument for the action in this step. Operators will need to input the action argument in hexadecimal format.
Invokethepayload.FirmwareImageAccess.LoadImageFromStorageaction with the input argument,Last row= the size of the image in rows - 1 (refer to Section A for the size of the image in rows).
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
Yes |
Data Size |
2 bytes |
Data Info |
|
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
C.15.
Again
Querythepayload.FirmwareImageAccess.ImageBufferparameter.This time, ensure that the data returned = the size of the image in rows (refer to Section A for the size of the image in rows).
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
Rows ( + ACK ) |
Data Size |
2 bytes |
Data Info |
The number of rows of data in the buffer |
Allowed Value(s) |
0000 - FFFF (Hex) |
Expected Value |
The size of the image in rows from Section A |
C.16.
To further verify the image is now correctly loaded into the buffer,
Getthepayload.FirmwareImageAccess.ImageCRCparameter.Ensure that the data returned is equal to the CRC from Section A.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
|
Data Size |
4 bytes |
Data Info |
CRC for the data currently being held in the |
Allowed Value(s) |
00000000 - FFFFFFFF (hex) |
Expected Value(s) |
Image CRC from Section A |
D. Reprogramming the CPLD
D.1.
Getthepayload.GMOD.LineNoLastProgrammedparameter.Ensure that 0 is returned.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
|
Data Size |
2 bytes |
Data Info |
Line number last programmed from the OBC to the MSP/CPLD |
Allowed Value(s) |
0000 - FFFF (hex) |
Expected Value(s) |
0 |
D.2.
Getthepayload.GMOD.CPLDReprogrammeStatusparameter.Ensure that 3 (i.e. its initialisation value) is returned, indicating that the CPLD reprogramming process on the MSP is not currently on-going.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
|
Data Size |
2 bytes |
Data Info |
Status of CPLD reprogramming |
Allowed Value(s) |
See table below |
Expected Value(s) |
03 |
Where…
|
Status |
|---|---|
00 |
In progress |
01 |
Success |
02 |
Fail |
03 |
Init |
D.3.
Invokethepayload.GMOD.CPLDReprogrammeaction to start the reprogramming process.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
D.4.
Get, and continue to get, thepayload.GMOD.CPLDReprogrammeStatusparameter until 1 (i.e. its success value) is returned.
Tip
If 0 is returned, the CPLD reprogramming is still in progress.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
|
Data Size |
2 bytes |
Data Info |
Status of CPLD reprogramming |
Allowed Value(s) |
See table above (i.e. in Step D.2) |
Expected Value(s) |
01 |
D.5.
Getthepayload.GMOD.LineNoLastProgrammedparameter.Ensure the returned TM = the size of the image in rows (determined in Section A).
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
|
Data Size |
2 bytes |
Data Info |
Line number last programmed from the OBC to the MSP/CPLD |
Allowed Value(s) |
0000 - FFFF (hex) |
Expected Value(s) |
The size of the image in rows from Section A |
E. Post-Programming
E.1.
In preparation for the next reprogramming,
Setthepayload.GMOD.LineNoLastProgrammedparameter to 0.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Action/Param ID |
1222 |
Data Expected with TC |
Yes |
Data Size |
2 bytes |
Data Info |
Line number last programmed from the OBC to the MSP/CPLD |
Allowed Value(s) |
0000 - FFFF (hex) |
Expected Value(s) |
0 |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
E.2.
Confirm the
Setin the previous step with aGet(i.e. confirm the value was set successfully).
E.3.
Getthepayload.GMOD.GMODModeparameter to assess which mode the firmware running on the MSP is operating in.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
No |
TM Details |
|
Data Expected from TC |
|
Data Size |
1 byte |
Data Info |
Payload operational mode |
Allowed Value(s) |
See table below |
Where…
Firmware |
|
Mode |
|---|---|---|
GMOD |
1 |
Idle |
GMOD |
2 |
Experiment |
GMOD |
3 |
CPLD |
GMOD |
4 |
Safe |
E.4.
If the
payload.GMOD.GMODModeparameter indicates that Idle Mode is on-going, this procedure is now complete.Else, now
SettheGMODModeparameter to 1/Idle Mode.
TC Details |
|
MCS Operation |
|
Action/Param Name |
|
Data Expected with TC |
Yes |
Data Size |
1 byte |
Data Info |
The mode to set EMOD to |
Allowed Value(s) |
0-1 |
Expected Value(s) |
1 |
TM Details |
|
Data Expected from TC |
No ( + ACK ) |
E.5.
Confirm the
Setin the previous step with aGet(i.e. confirm the value was set successfully).
Tip
It may take the payload MSP ~tens of seconds to complete the mode change.
END OF PROCEDURE