Pf sc diag
From DIDEAS Wiki
definitions
- SC/MC = PCB with both the state controller and motor controller processors.
- SC = state controller, generic reference to the SC/MC
- MC = motor controller, generic reference to the motor controller part of the PCB - or the whole motor controller process + power board
- SM, STATEMACHINE : the primary statemachine that doesn't what were here for.
- MC_SM, MOTOR (controller) statemachine, a state machine that runs on the motor controller that does impedance control, and handles overloads, etc.
- ISP = in system programming - connectors / signals that are connected to ICD2 / Real-ice dsPIC programmer
- FUP = field update port, Either of two 9 pin connectors on SC/MC board, uses ASYNC serial to communication without outside world. Also has pins for ISP
- ISR = interrupt service routine
Root for the SC
ap_main.c:main() : starts off with initialization, and then becomes main loop (primary thread)
- performs hardware and variable initialization, calling many sub functions for initialization
- enables ISRs (which are defecto prioritizeable threads)
- At least two ISRs that operate the DMA that move data for the SPI and UARTs
- Tick timer ISR. Effectively sets a global that says tic. Don't believe does any actual work.
- ultimately gets to the main loop of the code which is "while (1)"
This is the primary thread that does ALL the work. Although it appears to have only 2 functions : through nicely obfuscated coding, other functions get called.
At the next highest level we can say following actions are done in the main loop:
- execute_cmd_rsp (see last page of ap_main.)
- FUP = field update port, this is the ASYNC serial port interface to the outside world
- difficult to explain as functions convoluted and are misnamed . However over all this code block deals with the MPD command / response protocol.
- Gets 'messages' from buffers (either locally or from the FUP),
- Routes /forwards messages to MC/IMU,
- Processes message locally (command execution). MAJOR problem w/read real time clock, EEPROM
- Passes back "answers" from the IMU/MC,
- Answers requests to commands that we locally bound (executed)
- Only the SC(both locally and via its FUP) can initiate messages that are executed on another processor (MC, IMU);
- This block of code is the primary problem with the system.
- We need to be able to send/route messages asynchronois to the STATEMACHINE (eg SM)
- Thus the simple routing function needs to be in a thread at a HIGHER level than the SM , and we send messages asynchronous from the state controller, and we need to be
- This block of code is the primary problem with the system.