Mike Engstrom Capstone 2009 Blog
Return to capstone2009 main page
ECE413 / Michael Engstrom / WPR Week of 2009/5/31
Last Week
Poster Presentation
Gathering requirements for final presentation, report
Next Week
- Report and Presentation due
Issues
ECE413 / Michael Engstrom / WPR Week of 2009/5/24
Last Week
Changed aps state machine code to function pointer structure
Researched LPC2378 manual for pin settings to get our code working
Getting ready for Poster Session
Next Week
- Test aps state machine code
Issues
- Still figuring out LPC2378 differences
ECE413 / Michael Engstrom / WPR Week of 2009/5/17
Last Week
Researched state machine code in C
Set up LPC2378 development board
Started new repository for LPC2378 freertos implementation
Compiled and ran sample program on new repo
Branched 'master' repository for working on APS state machine
Implemented first draft of state machine
Next Week
Rewrite APS state machine to use pointers to functions
Test state machine
Get familiarized with new freertos implementation
Issues
- Need to debug some errors in APS state machine
Notes for APS State Machine
Pseudocode for rough draft of APS state machine
enum aps_state //easier to use real names when referring to states
- sleep = 0
- wake
- safe
- armed
variable rocket_mode = sleep //could init into other state if desired
task apssm_task
get data from environment checklist
change state depending on data //for demo, use buttons
if button 1 triggered
switch rocket_mode
case sleep: rocket_mode++, output new mode to serial
case wake: rocket_mode++, output new mode to serial
case safe: rocket_mode++, output new mode to serial
case armed: rocket_mode = sleep, output new mode to serial
end switch
if button 2 triggered
rocket_mode = sleep //simulate reset sequence
output 'reset event' and new mode to serial
keep looping apssm_task
Software Team Notes 2009/5/17
Downloaded new freertos repository for LPC2378
Used 'make' to build BlinkyLightSample.hex
edited oocd... file to include BlinkyLightSample.hex
needed to jumper a pin to the one next to the cat-5 connector for programming the board
program runs fine
Looking ahead:
Get the crude state machine for the APS running
Use an enum for the states
Consider using buttons, one for incrementing state and one for resetting state machine
Look at UART code in the new freertos files, understand some of the new fprint, etc. functions
ECE413 / Michael Engstrom / WPR Week of 2009/5/10
Last Week
Finished error string array structure
Tested error messages, made commits and pushed code to repository
Prepared for switch to new dev boards
Next Week
Write rough draft code for APS state machine
Switch to LPC 2378 dev board
Issues
- git-push still not working from home
ECE413 / Michael Engstrom / WPR Week of 2009/5/3
Last Week
Updated error.h with first draft of string array
Planned code structure with Jeremy at PSAS meeting (see my PSAS blog)
Next Week
- Make choices of freertos task structure, complex or simple, find direction
Issues
- git-push not working from home for some reason; make commits offline and push when at PSU
PSAS Meeting Notes 2009/5/5
Talked w/ Jeremy about structure of our code
Would like to use multiple tasks with tiered priorities
Top priority for bus tasks (one for each) and data repository
Mid priority for state machine and data processing
Low priority for ????
FW notes:
State Machine should have its own task
Listen for critical inputs, check current state and data, determine whether to change state or remain in current state
Current states: Sleep, Wake, Safe, Armed
Sub-functions in State Task will perform internal tasks
Capstone Meeting Notes 2009/5/1
Only 40 days left! There is a lot of work (and pain) coming....
This week we want the individual schematics to be stitched into a whole
No "cargo cult" thinking with design decisions - design documentation needs to be filled out on the wiki this week
5 minute lecture on SPI, 1-wire, etc. by Andrew
Differences between synchronous (like SPI and I2C) and asynchronous serial buses
Review of data transfer for a SPI MOSI/MISO setup (4-wire)
I2C review (down to 2-wires...)
UART
independent Tx and Rx
sender and receiver need to agree on clock rate
start and stop bits, timing drift can cause big communication problems
- UART receiver constantly resynchronizes to keep data lined up correctly (phase lock)
CAN ~ glorious hybrid of all of the above
open collector (mosfet) to pull down bus when data is for you
assert ground, check bus ~ "open collector, multi-bus"
Andrew moved to talking with FW guys (Jeremy and me)
ECE413 / Michael Engstrom / WPR Week of 2009/4/26
Last Week
Created diagram for error structure planning
Attended Capstone schematic review
Still working on error structure / error handling
Next Week
- Get help finishing error handling structure - K or Andrew?
Issues
- Need more practice merging with git
Diagram Notes for Errorhandling 2009/4/28
I have been working on conceptualizing the error handling code
It really helped to put everything down in diagrams below is the result of my work
My next step is to implement it in the code:
- These should help with implementing my code. BTW, I am not happy with the picture formatting in this particular wiki. Oh, well, you get what you get.
ECE413 / Michael Engstrom / WPR Week of 2009/4/19
Last Week
Updated error.c, error.h, and main.c, made commits
Fixed error.h, two functions from error.c were not referenced
Structured error flow using diagramming
Next Week
Finish error structure, error function to get error #, error order, and string ascii name for error and send all to the serial
Push changes to errorhandling repository
Issues
- None
Capstone Meeting 2009/4/17
Jeremy has had problems with the UART in the errorhandling main. The code is the same structure as the pressuresensor main, but it is having problems. Jeremy had K take a look at it on Tuesday 4/14, and he thought it was correct. The takeaway was that possibly minicom is not set up right. We will keep pounding away at the problem.
We are moving our development to the 2378 development board, according to Andrew. One is ready, which Jeremy should have first since his 2148 is having problems. I will get the next one that is ready.
Jeremy and I will meet with the PSAS software team, or at least Dave, K and Andrew, and talk about how we want to set up the software structure with freertos. The freertos code is going to be converted over to the LPC2378, and everything should(!) work the same.
The rest of the meeting for the software team will be used to get the UART working and the errorhandling code working.
ECE413 / Michael Engstrom / WPR Week of 2009/4/12
Last Week
Uploaded first draft of error handling functions / error structure
Became proficient enough in git so Jeremy and I are able to share files easily
Attended PSAS meeting, code planning and troubleshooting
Next Week
Test error handling code
Find out further requirements for our team.
Issues
- None
PSAS Meeting Notes 2009/4/7
Jeremy had a better main.c than I had, so we wanted to push my error.c and error.h but leave out the main.c
Got help from Jamie with pushing my files to our errorhandling branch. Much appreciated.
Jeremy will focus on the main.c, and I will flesh out the other files.
We will commit our changes and push them to the server.
Capstone Meeting 2009/4/3
Software chores: IMMEDIATE PRIORITY
Due Friday 2009/4/10
Use PIC code as reference; look for pic-core....
Error logging
- FIFO, log errors and keep in memory, able to get on command: error, # of occurrences, order
Commands
pipe
reset
force state
event log
All sent over UART. UART should be a thin shell that sends the commands over the appropriate bus for the device in question.
Plan of attack:
Get PIC code
Make branch in git for our code
Email our plan
Meet Saturday or Sunday to pound out code
Repeat as necessary
ECE413 WPR Week of 2009/3/29
Last Week
Discussed SPI changes to freertos repository with K at PSAS meeting
Got clone of latest freertos
Studied structure of code
Next Week
Still have some details of git to understand
Have software team meeting to develop structure for capstone code
Issues
- Still trying to figure out new changes to the freertos code
Notes 2009/4/2
Talked to K on Tuesday, mentioned that I had planned to split up the SPI code from the sensor code. He had already done that, so my next step is to get the latest code from the git repository.
Got the latest version of freertos. The new 'spidev' folder seems to contain the code I want.
Maybe that is not the file I expected. Looks like I am spending the next while figuring out what is what....
Capstone Meeting 2009/3/27
Ai Ling and Scott are trying to get set up with git on their windows boxes, using the Cygwin command line
I gave Andrew a summary of the SW meeting Jeremy and I had
Software Team Meeting 2009/3/26
Discussed structure of freeRTOS downloaded from PSAS server using git
Reviewed I2C plan Jeremy has been working on
Our code will have a state machine that monitors the built-in LPC2148 HW I2C state machine
Next goal for Jeremy and I is to get a FW framework put together, specifically for the APS, using the old PIC code as a guide and the requirements from our PIC Review meeting on 2009/2/20
ECE 412 / WPR - Week of 2009/3/22
Last Week
Installed git on laptop, learning to use it
Downloaded repository copy, examining file structure
Had software planning meeting with Jeremy to discuss I2C for project
Next Week
- Learn to use features of git
Issues
- n/a
Capstone Meeting Notes 2009/3/20
Resent ssh/username pair to Andrew for accessing git repository on PSAS. Able to download current freertos code with updated pressure sensor jive.
Andrew wants Jeremy and I to begin writing code to make lights blink, output values, etc. Part of the problem we have on our team right now is we are about a month behind. We need to reassess, perform a design review, and recalibrate where we will be headed.
I suggested that the Software Team could:
Review the PIC requirements from our overview several weeks ago
Examine the older PIC software structure
Apply both of the above to building a framework in freertos for our project. We can stub out the parts which are not ready and plug them in as available.
Andrew thinks that is a great idea.
Pressure Sensor Test 2009/3/13
Had a long wait for the Prof to arrive and set up the vacuum chamber.
Eventually chamber was set up by someone else, and Daniel H. was able to get values. He ran the tests both from low-to-high pressure and a quick depressurization.
See the pressure sensor testing page for all the info.
Capstone Meeting Notes 2009/3/13
Andrew wants Jeremy and I to be working on our 'prelab' code and research better. We were not very ready to roll at the Tuesday PSAS meeting and needed a lot of help from K and Dave. A big thing for me to work on is the process of setting up the configuration for a given sensor. I know better how the process works and can be more efficient. I also know better how to ask for help and when (as early as possible).
Jeremy and I need to coordinate better with the responsible parties for the sensors (such as Ai Ling). We need to have more questions ahead of time so that when a SW/sensor deadline comes we can be ready to go.
Ken was asking about naming conventions when creating EagleCad documents, and Tim pointed him to the RocketNames page. 'Nuff said.
Andrew and Tim were debating whether we should be using git for a CAD repository. Andrew says 'yes' and it will be up in a couple of days, probably under the name ecad or somesuch.
Next we are heading over to the Physics department to test our sensors and code.
WPR - Week of 2009/3/8 - Michael Engstrom
Last Week
Worked out timing and UART requirements for sensors
Wrote code to configure SPI for SCP1000 pressure sensor
Sent in ssh data to PSAS Admin to be able to access files on server
Next Week
- Pressure chamber test for devices
Issues
- Have a lot to learn still about writing code for configuring devices
PSAS Meeting Notes 2009/3/10
We have a hard deadline Friday to perform our pressure sensor tests; Daniel H. needs the data for his report due Monday. Spent most of the meeting configuring our sensor setups. Jeremy and Dave worked hard at getting the ADC to send data over the UART. Many obstacles were overcome, not the least of which was a messed up GTK. K and I made progress with the SPI configuration. Mainly I realized that I am not very familiar with setting up devices to talk over data protocols.
The assistance from K was a huge help, We wrote up configuration files to get the SCP1000 configured at 'High Speed' mode, 17 bits of accuracy. The SPI protocol is a little convoluted, dummy writes are needed just to be able to grab data from the device. In fact, for every read there must be at least two writes (I think), as well as the DRDY pin being set and a status register check to clear a value.
I am starting to understand the process, and K assures me that it will be easier once I get some practice setting up devices. We stayed 'til after 11pm working on things, and we might be coming in Thursday to finish up. It must be ready by Friday. Dan F said he would email Andrew his SPI code, so that may make things easier.
Software Notes 2009/3/8
Working on getting SPI configured. Without an SPI device (Andrew has the SCP1000 to get it soldered to the test board for next Friday), so back to trying to get SPI0 talking with SPI1. Tried to get some organization as far as file setup goes.
Making copies of the freeRTOS files becomes complicated when trying to remember what was done, and when. Need to be proactive in getting hooked up to a repository, make life simple and be able to better coordinate with Jeremy.
Capstone Meeting Notes 2009/3/6
After a nice pizza break...
Discussed sensors/protocols, timing requirements
1 KHz likely speed to use
Use header, sensor data over UART, poll devices, update data when ready
Some devices will be ready sooner, grab data as available and populate data stream
WPR - Week of 2009/2/23 - Michael Engstrom
Last Week
Performed overview of PIC controller SW with Andrew
Started determining with Jeremy the requirements for our Capstone SW
Downloaded freeRTOS files files from jcwren site, examined SPI, I2C and USB configurations to see if Jeremy and I could apply it to project
Studied I2C configuration files from LPC2148 manual
Next Week
Determine what flavor of freeRTOS Jeremy and I will be using
Get SPI and I2C talking for demo with Andrew
Issues
- Still not able to get configurations files figured out to get SPI going, need to get help in setting it up
Software Team Meeting Notes 2009/3/1
Today was a meeting day for Jeremy and I to get the sensors working on the Olimex boards. My board had an issue with programming, namely that it could not be programmed via the jtag connector. I had been trying some of the jcwren code, and while it compiled fine I am not sure if the board was having trouble running the .hex file.
As an check to see if other, older code still would work poke.hex was attempted to be flashed to the board. Nothing. I looked for the directions to flash the Olimex board using the serial cable. All I ended up doing was moving switch 1 to "on" and running the myocd and ocdflash commands like normal with the serial cable hooked up.
The output showed some complaining about not finding the jtag connector, but the program was flashed to the board fine over the serial port. Subsequent flash attempts using the jtag connector now worked fine, so this looks to be a troubleshooting method to be used in the future.
We discussed the direction we wanted to go as far as the jcwren code. As far as we can tell the jcwren code makes our boards unresponsive to the point that the serial port rescue method needed to be used to return to normal. It may be that we are not proficient enough to get the flash working correctly and K or someone could help us get things corrected, but for now we will only use the jcwren code as a reference and import the things we like about it into the existing PSAS freeRTOS code.
The changes I have made to main.c and other files could have broken the flow of the program. I probably just need to use git to pull the files down from the PSAS repository and have a fresh slate. This highlights our need for our own capstone repository. Second only to getting the sensors working, that needs to be a priority.
The ADC is working, but we need to have better control over what pins it uses, how many channels are implemented, bit rates, etc. Jeremy plans to write some code for the I2C and place some stubs for the SPI code I am working on. We may need some technical advice and help in getting things moving. Hopefully we can have something to test with by Tuesday's PSAS meeting.
Capstone Meeting Notes 2009/2/27
Andrew will try to wire up a 2148 board with the pinouts for the sensors we will be using
At the PSAS meeting Jeremy and I plan to work on demoing ADC, I2C and SPI
Jeremy and I are meeting Sunday at 4:00 by the CAT office to work on getting I2C working in advance of Tuesday's PSAS meeting
Andrew wants to go over more flowchart stuff related to what the PIC performed, but priority right now is getting our sensors working
I will try to install the jcwren freeRTOS version at http://www.jcwren.com/arm/ for to see if the SPI will work on it
WPR - Week of 2009/2/23 - Michael Engstrom
Last Week
Performed overview of PIC controller SW with Andrew
Started determining with Jeremy the requirements for our Capstone SW
Downloaded freeRTOS files files from jcwren site, examined SPI, I2C and USB configurations to see if Jeremy and I could apply it to project
Studied I2C configuration files from LPC2148 manual
Next Week
Determine what flavor of freeRTOS Jeremy and I will be using
Get SPI and I2C talking for demo with Andrew
Issues
- Still not able to get configurations files figured out to get SPI going, need to get help in setting it up.
Capstone Meeting Notes - 2009/2/20
David showed some choices for batteries and chargers, see the battery specifications page
There was a question as to who is in charge of battery sensors, it should likely be a David / Scott responsibility
Scott is wondering where he should be with the power switches, Andrew wants him to focus on the APS for now and tackle other stuff later
This may mean Ai Ling should work on the battery sensor issue for now
Andrew want an evaluation board for the battery charger
Jeremy and I are going to work on the overview of our code structure; we also have an AR of getting the pressure sensors up and talking on the LPC2148. Bye.
PIC Overview Notes – 2009/2/20
Functions of PIC: power switching to various subsystems
Over current monitoring and “circuit breaker” functionality
Battery Management
- Read battery voltages and currents
- Pack voltage
- Cell voltage
- Charge counting into capture timer (charge, calculate amps = charge/delta_T)
Never turned off unless disconnected
Umbilical
- Monitor shore power
- Rocket Ready signal, SAFETY CRITICAL
- Relays will prevent launch if there are problems
- Any node can give the Scrub Launch signal
APS must have different states
- Sleep Mode
- Wake Mode
- Safe Mode
- Armed Mode
Error Handling
- Error levels
- Error Logs
- Error messages
- Serial console
- Request error logs
- Poke at registers
SEE FULL PIC NOTES POSTED ON MAIN CAPSTONE PAGE
Requirement Takeaways:
Best to start with APS state machine first so infrastructure questions are answered, then move to Recovery state machine design
All sensors, power supplies (pyro, sps, etc.), communication checks needed before cleared for launch
Eagle CAD Tutorial notes - 2009/2/17
Get goodscripts.scr and run the command script goodscripts.scr in the command line of EagleCad
Find PSAS library at http://psas.pdx.edu/EagleCad
To use my own library go to Library -> Use
Also good is to add :psas library file name in the Directories window
All nets should have meaningful names
Use the ERC Error check to make sure everything is OK
Follow naming convention from PSAS site
WPR - Week of 2009/2/16
Last Week
Worked at getting SPI0 and SPI1 configured for LPC2148
Attended Eagle Cad seminar
Next Week
Review PIC with Andrew
Study structure of freeRTOS with the goal of including SPI configuration
Issues
Having a hard time tracking down the files necessary in freeRTOS to configure SPI
Jeremy and I need to get a code repository set up, and soon
Notes 2009/2/16
I spent several hours working on the configuration for SPI. Mostly I tried to edit the freeRTOS files to include the spi.c and spi.h files I have written. I finally got the files to compile when I commented out most of the guts of my code....
Most of my problem stems from a lack of familiarity with freeRTOS and where it keeps files, variables, configuration data, etc. I was somewhat educated through the process of tracking down solutions to compile errors and warnings, but I probably need to talk to K, or Dave or someone to clear up the muddle. It would also be good to go through the files with Jeremy and see what we can figure out.
Below is the body of my spi.c file. Part of my problem is finding the defined register names in freeRTOS, and seeing if I need to include the names used in my file. I have included the register values to initialize SPI0 as master and SPI1 as slave, with an 8-bit data width and a PCLK of 4.5 MHz:
(pound)include "helpers.h"
(pound)include "spi.h"
(pound)include "lpc214x.h"
(pound)include "FreeRTOS.h"
//int SPI0Read ( );
//int SPI0Write ( );
void initSPI0() {
// initialize the GPIO pins for SPI0 - PINSEL0
// bits
// 7:0 RSVD NA
// 9:8 SCK03 01 //
// 11:10 MISO0 01 //
// 13:12 MOSI0 01 //
// 15:14 SSEL0 01 //
// 31:16 RSVD NA
// 15 14 13 12 | 11 10 9 8 | 7 6 5 4 3 2 | 1 0
// 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1
// 0xFFFF55FF
PINSEL0 &= 0xFFFF55FF;
// SPI Clock Counter Register
// How Many PCLKs per SPI SCLK?
// Must be > 8
// Divide PCLK by this number; (4.5 MHz)/12 = 375 KHz
S0SPCCR = 0xC;
// write the control register S0SPCR
// bits
// 01 0
// 2 BitEnable 0 // (11:8 controls # of bits) 0 means 8 bits
// 3 CPHA 0 // clock phase control
// 4 CPOL 1 // active low (falling edge?)
// 5 MSTR 1 // master mode
// 6 LSBF 0 // MSB First
// 7 SPIE 0 // no interrupts
// 11:8 BITS 0000 // 8 bits per transfer
// 15 14 13 12 | 11 10 9 8 | 7 6 5 4 3 2 | 1 0
// 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0
// 0x0030
S0SPCR = 0x0030 & S0SPCR_MASK;
DBG("End of SPI0 initialization.\n\r");
}
void initSPI1() {
// initialize the GPIO pins for SPI1 - PINSEL1
// bits
// 1:0 RSVD NA
// 3:2 SCK1 10 //
// 5:4 MISO1 10 //
// 7:6 MOSI1 10 //
// 9:8 SSEL1 10 //
// 31:10 RSVD NA
// 15 14 13 12 | 11 10 9 8 | 7 6 5 4 3 2 | 1 0
// 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1
// 0xFFFF55FF
PINSEL1 &= 0xFFFF55FF;
// SSPCPSR - Clock Prescale Register
// bits
// 7:0 CPSDVSR UNSURE of values here
// note: CPSDVSRmin = 2 for MASTER mode
// note: for SLAVE mode, clock must be < PCLK/12
// Set value to hex 12 for compatability with SPI0
CPSDVSR = 0xC;
// write the control register SSPCR0
// bits
// 3:0 DSS 0111 // Reserved
// 5:4 FRF 00 // Frame format is SPI1
// 6 CPOL 0 // Capture serial data on first clock transition of the frame
// 7 CPHA 0 // Bus clock low between frames
// 15:8 SCR 00 // Serial Clock Rate, clocks per bit on bus
// 15 14 13 12 | 11 10 9 8 | 7 6 5 4 3 2 | 1 0
// 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
// 0x02A8
SSPCR0 = 0x7 & SSPCR0_MASK;
// write the control register SSPCR1
// bits
// 0 LBM 0 // Normal operation (1 for loop-back mode)
// 1 SSE 0 // SSP controller disabled
// 2 MS 1 // Acting as slave here
// 3 SOD NA // Not applicable in slave mode
// 7:4 NA // Reserved
// 15:0 DATA 0 // Data section, initialize to zero
// 15 14 13 12 | 11 10 9 8 | 7 6 5 4 3 2 | 1 0
// 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0
SSPCR1 = 0x6 & SSPCR1_MASK
DBG("End of SPI1 initialization.\n\r");
}
Obviously this is not preferred to having a code repository; hopefully Jeremy and I can get that situation resolved soon.
Anyway, I will try to get help at the PSAS meeting. There is also an Eagle Cad class scheduled, and that should be informative. Bye.
Capstone Meeting Notes 2009/2/13
Jeremy and I will meet with Andrew next Friday 2/20 @ 11:00 AM to review the PIC
Daniel Heinlein from PSAS is here to talk with Ai Ling and Andrew about pressure sensors
Scott is explaining choices for power chips
K stopped by and asked if Jeremy and I needed any help. I might take him up on his offer to help get my SPI code configured.
Andrew wants a test of 4 analog USB channels and 1 SPI channel targeted for next week, possibly in two week
WPR - Week of 2009/2/9
Last Week
Worked with Jeremy on SPI code
Planned code repository for project
Next Week
- Look at working Ai Ling's pressure sensor algorithm into code
ARs
- Write functions to talk to pressure sensors on SPI
Notes 2009/2/8
Finished writing the initialization functions for the SPI loopback test
Next task is to develop the framework of what data to send back and forth from SPI1 and SPI0, and how to display the results
freeRTOS seemed to compile just fine with the new SPI code
Did some research, saw that the SCP-1000 pressure sensor acts as a slave on the SPI bus. This is good news since configuring SPI0 is relatively easy. It is configuring the SPI1 that is tricky because it shares the I/O pins with a couple of devices and must be initialized correctly. If I can get the SPI1 working and talking to the SPI0 then I can handle communications on any device.
WPR - Week of 2009/2/1
Last Week
Helped K troubleshoot Jeremy's Olimex board
Worked on SPI configuration functions
Next Week
- Test and troubleshoot SPI functions
ARs
Get SPI running
Write functions to talk to pressure sensors on SPI
Issues
- Need more research and practice with freeRTOS, dev board, LPC2148
Notes from PSAS Meeting 2009/2/3
Andrew cannot make the meeting, but Tim was there and Jeremy and Ken attended as well. K helped debug a problem Jeremy was having with editing main.c of freeRTOS. We swapped my board with his and things seem to work, so maybe his board has a hardware problem.
Regarding the main.c, Jeremy tried to edit the flash rate of the LED and it did not seem to change, so we investigated whether or not the file was compiling and we were grabbing the correct .hex file.
I continued to chip away at getting the register files set up to loop SPI0 and SPI1.
Notes 2009/2/2
Since the LPC2148 supports it, I had an idea of setting up the SPI0 and SPI1 as a Master/Slave connection and sending data back and forth. It is looking like SPI is a choice for at least one of our sensors. I researced the manual and found the information in Chapters 12 (SPI0) and 13 (SPI1) regarding register values
Using the example code K sent Jeremy and me:
/*
* enable_spi0
* Configure pins for SPI
* p0.4-01 9:8 of PINSEL0 SCK03
* p0.5-01 11:10 of PINSEL0 MISO0
* p0.6-01 13:12 of PINSEL0 MOSI0
* p0.7-01 15:14 of PINSEL0 SSEL0
* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
* 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1
* 5 5 f f
*/
inline void enable_spi0(void) {
PINSEL0 &= 0xFFFF55FF; // SPI0 Configuration P0.[4,5,6,7]
}
and from the spi.c function:
void initSPI0() {
// SPI Clock Counter Register
// How Many PCLKs per SPI SCLK?
// Must be > 8
S0SPCCR = 0xC;
// write the control register S0SPCR
// bits
// 01 0
// 2 BitEnable 1 // (11:8 controls # of bits)
// 3 CPHA 0 // clock phase control
// 4 CPOL 1 // active low (falling edge?)
// 5 MSTR 1 // master mode
// 6 LSBF 0 // MSB First
// 7 SPIE 0 // no interrupts
// 11:8 BITS 0000 // 16 bits per transfer
// 15 14 13 12 | 11 10 9 8 | 7 6 5 4 3 2 | 1 0
// 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0
// 0x0034
S0SPCR = 0x0034 & S0SPCR_MASK;
DBG("End of SPI0 initialization.\n\r");
I worked out the data values necessary for the registers to set up both SPI0 and SPI1. Tomorrow at the PSAS meeting I hope to have something ready to try out. Bye.
FW Meeting Notes 2009/1/30
My board was set up with freeRTOS and makes the "annoying beep" it is supposed to when pressing the button. Since I need to get communications on the SPI bus and the Olimex board has two SPIs my idea is to make one the master and the other the slave and let them talk to each other. Looking at the schematic, SPI1 shares IO with other devices but SPI0 has dedicated pins, so I will make SPI0 the master.
I need to look at the manual, see what bits need to be set for the SPI registers, and write a function that performs those tasks. Then when I have the master and slave configured I will send data from one to the other and run each one to a separate serial output to confirm the data transfer. The SPI function can be included in the main.c of freeRTOS to initialize when the OS starts up, and the OS can deal with the interrupts and priorities.
K explained how the git repository works, but he wants to wait until Tuesday to get the repo Jeremy and I will be using uploaded to the PSAS server. The changes I make will live on my laptop until then.
Capstone Meeting 2009/1/30
Attendees: All team members, sponsors, advisor
Jeremy and I have an AR of getting our boards up and running with a function that grabs data from the SPI and ADC and outputs the data to serial or USB.
The SPI task is my ownership, Jeremy owns the ADC responsibility
Andrew wants Ai Ling to get an "absolute" pressure sensor chosen and acquired so a vacuum test could be performed, hopefully as soon as next week. High priority
Time to go do FW stuff
WPR - Week of 2009/1/26
Last Week
Met with K. from PSAS, practiced setting up development environment
Installed freeRTOS code on my laptop and successfully installed program on dev board
Researched SPI, LPC2148 specs, gnu make, and freeRTOS
Next Week
Try to add functions to freeRTOS to send/receive data on pins (in preparation for real sensors)
Get together with Jeremy / K / Andrew etc to figure out requirements and framework for the code we will be writing
ARs
- Attend PSAS Club meeting next week
Issues
- Need more research and practice with freeRTOS, dev board, LPC2148
Notes from PSAS Meeting 2009/1/27
The wall adapter I picked up at Goodwill works great. K and Dave helped download and set up freeRTOS on my dev board and explained a bit about the structure of the program. Things are at the point that I can modify programs to run on my dev board and I need to begin to interface with data devices. This will be a critical skill for when the different sensors are chosen and Jeremy and I must figure out how to talk to them. The idea is to use freeRTOS to provide a framework for our functions and speed up our development time.
I left relatively early to go and pick up an extra serial cable my Step-Father had. They are surprisingly hard to find, and since my laptop has serial out I can avoid headaches that come from using USB-Serial adapters by having a regular cable.
Notes 2009/1/24
I spent most of the late morning and early afternoon trying to configure my Airlink 150N cardbus to connect to my wireless router. I used some tutorials to find that the chipset was ra2860sta, so I went to their site hoping for a Linux driver.
The RALink site had drivers so I was in luck, and I downloaded the files and used the readme to configure and compile the driver and attach it to the kernel. This took me about 3 hours, and the rest of my time has been taken up in trying to get it to talk to the network. Pinging the loopback works OK, pinging the address of the card works OK, but I still can not get on the network.
Maybe it is related to how I have my router set up, or some configuration file setting that is incorrect, or the error between the chair and the terminal, but it will have to wait until later. My cat5 cable works for now, and maybe I can get some advice at the PSAS meeting or ask K next Friday.
There are some good sources of information out there for the Serial Peripheral Interface (SPI) bus, and I have been researching how to talk on such a network. Some of the FW stuff I have been banging my head against at work deals with SPI, so I should be a SPI expert by the time my internship and capstone are done. I also have been researching the freeRTOS documentation; Jeremy and I need to come up to speed fast. The learning curve is painful, but as they say, pain is weakness leaving the body (or mind in this case).
On my way home from class Friday night I stopped at Goodwill and found a nice compact wall adapter that is perfect for my LPC2148 dev board. I am finding it difficult to find a serial cable, new or used, so it may be an excuse to head to Frys tomorrow. At least I do not have to worry about finding a different wireless cardbus adapter, since mine is close to working.
Notes from FW Meeting 2009/1/24
Jeremy and I left the capstone meeting early to work with K, and again he was greatly of help. Jeremy was able to compile a program, send it to the LPC2148 dev board, and run commands that beeped and flashed and sent text out the serial cable to the minicom terminal on his laptop. Again, we are trying to overcome our Linux rustiness in addition to getting the tools to work.
Just as a reminder, there are typically at least four terminal windows running when we are working with the dev boards:
Minicom is running to see the print messages from the dev board
The myocd alias is run in a second window
A third window has a second alias ocdflash to send the .hex file to the board
The last window is used for moving around in the file system and running commands
Note that the make, myocd, and ocdflash commands should be run in the folder that the program to be compiled resides in. The alias psas should be run before the myocd command to point to the correct path.
Of course we need to have already used the make command to generate the .hex file to send to the board. K showed us where the libraries were for the functions, and we need to get familiar with the initialization routines used in pretty much every .c file. We also need to become comfortable with modifying the functions.
Andrew will be expecting us to be able to talk to sensors sooner than later, so our next goal needs to be talking to specific pins on the dev board. Ai Ling should have an accelerometer for us soon, so we need to be ready. We need to know the specs of the LPC2148 by heart, research SPI, and also research freeRTOS. This will wait for tomorrow, though. I am tired now.
Capstone Meeting 2009/1/23
Attendees: All team members, sponsors, advisor
Scott asked about documentation requirements, Andrew stated that we are not solving a problem but ramping up on a project that is partly defined. He wants everything on the wiki, but they also want a final form that has an intro, exec summary, each team member parts, etc. All our parts will be combined in a complete document.
The poster presentation requirement came up. Andrew pointed out that we are responsible for that element of the project.
The final presentation for the PSAS group will be a powerpoint presentation where we will be mercilessly questioned by the group members.
The due date for the PDS was brought up. We need to look at what Prof. Faust requires and what Prof. Taylor expects in terms of a PDS.
Grading is mentioned in the Capstone 2009 site, we are all aware of the guidelines.
There is a form on Prof. Faust's Capstone site that needs to be completed by the meeting next week - “Capstone Team Evaluation Form”
Dave and K are looking in to the CAN bus to see if the hardware can be managed. If so the CAN bus may be an option.
Jeremy still has some issues with tools; K will be here later to help him finish setting up his development environment.
Andrew wants Jeremy and I can have freeRtos running and be able to control the development board hardware. We also need to learn the LPC2148 inside and out, and be ready to interface with the pressure sensors and accelerometers that Ai Ling is researching.
Andrew has had conflicting information about the availability of vacuum chambers at the PSU campus. This needs to be determined.
As far as accelerometers, Tim would like to have everything use SPI for data. The maximum thrust would determine what g-forces the rocket will deal with. 20 g is the estimated limit with spikes of 25-30 g.
Ai Ling needs to write specifications for the accelerometers and get APIs together for Jeremy and I.
Jeremy and I left with K to work on development jive. Bye.
WPR - Week of 2009/1/19
Last Week
Met with K. from PSAS, set up development SW on my laptop
Ran simple programs on Olimex board (LPC2148)
Researched board and Dev SW
Next Week
Modify and run more programs on Olimex board
Keep in touch with Ai Ling regarding sensor choices, look at which pins data will be sent over
ARs
- Attend PSAS Club meeting next week, get help with development SW setup from Dave and K
Issues
- Need more practice setting up development environment and running programs
Notes 2009/1/20
Attended PSAS meeting at the CS Lounge. We took a picture with the airframe that might be in a magazine.
Dave helped me get the Eagle cad viewer setup on the Linux side of my laptop. I brought my Olimex board and the connector, so K had me set it up and make sure we could run a program.
K and I were able to run the same program as Friday using my board and cables; in fact it seemed to work better. I do need to pick up a serial cable, and possibly look around in my junk at home for a 9v wall adapter. Note to self: look at schematic to make sure the polarity is correct for the adapter.
I need to run through the steps on opening up the different programs on the terminal windows. I know I need terminal windows open with this:
minicom
a window at file location ~/lpc-kit/Dev/2148/poke/src where I run the alias psas
another window with the same location ~/lpc-kit/Dev/2148/poke/src where I run the alias myocd
yet another terminal window for editing files, etc.
So with these windows open I can edit programs, compile them with make, and send them to the LPC2148.
The USB cable is hooked to the JTAG device, which is connected to the JTAG port on the LPC2148, and a power whip comes out of the JTAG to power the board (see note above about finding a wall adapter instead), the compiled hex files are sent over the JTAG to the board, and the output is viewed on the serial cable hooked up to the 2148.
If everything works correctly, commands are sent in the terminal window that had the myocd alias, they are implemented on the board, and the minicom window outputs the text.
To get to the alias files I ran the command
editor .bash_aliases
and uncommented the specific program line I wanted to run, in this case poke. When I was in the poke directory and ran make the first time it didn't do anything because there was nothing to make. K had me type
make -f clean
and then run make again. I think the -f flag was there, I need to look at the man page again.
More later.
Notes 2009/1/16
K. has been very helpful in setting up the tools necessary for cross-compiling from my laptop to an ARM platform (hex files, etc). He had previously worked his way through the tedious process of installing all the development packages, configuring the various files, setting up the necessary folders and sub-folders, and working up some example C programs that would compile and run on the Olimex board. Many of these steps are included in a very long script file that he ran on my system.
After working through some issues with the configuration on my system, installing some necessary programs and files, and changing some configuration values we were able to compile and run an example program on the Olimex board that flashed some lights when buttons were pushed and showed output over a serial cable. Success!
My laptop is circa 2003, which is good in a way because it has a serial connection in back. K. says that the USB-Serial adapter cables can introduce some weird delays that I now do not need to worry about. I just connect the board to Serial 1.
Capstone Meeting 2009/1/16
Meeting notes:
Andrew and Tim have come up with a modified USB they are terming Universal Rocket Bus found at http://psas.pdx.edu/news/2009-01-15/. They are proposing a star topology to replace the hierarchical standard USB setup. Andrew would like to avoid connectors, and he does not like star and network topologies mixed. See an improved diagram at the page referred to above.
K. will be here to help Jeremy and myself get set up with the development tools.
Andrew wants Jeremy and I to attend the PSAS meetings (at least the first couple of hours) so that Dave and K. can help us get the development tools installed. Hopefully we can get some training in use of the tools as well.
As we find pertinent pages in the PSAS wiki we can link them from our blog.
A general task for all is to start cleaning up the wiki: fixing broken links, updating data, etc. Changes can always be backed out using the revision control.
Andrew gave an overview of various parts of the schematic for respective team members.
This week we will be gathering requirements for our individual and team tasks.
WPR - Week of 2009/1/12
Last Week
First meeting of the year - outlined project and roles
Installed Eagle viewer by Cadsoft.de
Installed Debian distribution of GNU/Linux on my laptop
Worked on getting software development set up on Linux laptop - still in progress
Next Week
Install remainder of development software
Contact Jeremy to pool knowledge for SW
Set up simple SW on dev boards
ARs
- Attend PSAS Club meeting next week, get help with development SW setup from Dave and K
Issues
Linux skills rusty - relearning curve
Package sources for Linux have changed which has made development software installation trickier
Notes 2009/1/13
I attended the PSAS meeting and talked to Dave about the issues I was having installing the cross-toolchain, and he suggested that a partition sounded like it was full. The partitions were installed as the default, and I saw that root only had about 500 MB allotted. I reinstalled Debian with at least 10 GB for each partition, and the files seemed to install fine so far. Here's hoping... time for bed.
Notes 2009/1/11
I have successfully installed Debian on my Dell Latitude D400 laptop bought for this capstone. My Linux skills are somewhat rusty. The main goal at this point (other than re-familiarizing myself with Linux) is to go through the steps found at http://psas.pdx.edu/CapstoneLV2bProjectReport/#index9h2 that the 2006 Capstone team had in their report for setting up the development software.
There have been some problems with setting up the cross-toolchain compiler. The cross-compiler howto at http://psas.pdx.edu/DebianCrossCompilerHowto/ lists the terminal commands to download and install the necessary packages, and errors come up saying there is no room to unpack the files. The disk is required for many of the commands, and I think I need to point the OS to a network location or something.
...OK, I have found how to remove the CD from the install tree. I am not sure if I should just move it below the ftp and http lines. I used the command
editor /etc/apt/sources.list
and commented out the cdrom line. Now to try again....
Well it did't seem to work. I ran the command
sudo apt-get build-dep binutils gcc-4.0
and the error message is
Unpacking libc6-amd64 (from .../libc6-amd64_2.3.6.ds1-13etch8_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/libc6-amd64_2.3.6.ds1-13etch8_i386.deb (--unpack):
failed in buffer_write(fd) (9, ret=-1): backend dpkg-deb during `./lib64/libc-2.3.6.so': No space left on device
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libc6-amd64_2.3.6.ds1-13etch8_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
E: Failed to process build dependencies
I will have to try it later. Maybe I can talk to the SW guys at the next PSAS meeting.
Team Meeting 2009/1/9
Attendees: all students, advisor, industry sponsors.
Andrew is working through the agenda.
Meeting Notes
Everyone needs to be on the PSAS mailing list.
All students have laptops or will soon.
Download and install the Eagle software.
Tuesdays seem to be the day for workshops that works for everyone. Andrew hopes that it will become a lab class at PSU soon. This will be tutorials for schematic capture, Eagle, etc.
Our capstone meeting will likely be Fridays at 2pm.
Andrew went over the parts of the project and who is assigned to what. 100 MHz radio will likely be added.
Format of data: (min, target, max)
Here is diagram Andrew drew of the baseline FW knowledge requirements for Jeremy and myself:
Here is the diagram on the board in the meeting showing the general layout of our project and which team member is responsible for what:
General Team Member Responsibilities:
SPS: Ken, Scott, David
Firmware: Mike, Jeremy
Sensors/Radio: Ai Ling
For next week: WPRs that include what we have read, questions about our assigned tasks and research. Feel free to use the PSAS avionics mailing list for questions.