Skip to content

Commit

Permalink
Add support for ELS Boost V2 (#19)
Browse files Browse the repository at this point in the history
* Fix 8-bit SPI mode for EEPROM.

* Add support for V2 EEPROM.

* Add test fixture project.

* Build test fixture

* Test key inputs and drive Larson scanner.

* Add 8K EEPROM testing.

* Fix comment.

* VREG test working on A5

* VREG test now working on Analog in B1.

* Finish test fixture.

Add stepper and alarm pin tests
Allow EEPROMs larger than 8K
Loosen VREG constraint to allow for unreliable pogo resistance

* Simplified test code.

* Fix VREG test.

* Switch default configuration to hardware version 2.

* Roll version number to 1.1.00
  • Loading branch information
clough42 authored Nov 30, 2019
1 parent 869d8b0 commit 540bce6
Show file tree
Hide file tree
Showing 107 changed files with 31,419 additions and 18 deletions.
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pipeline {
stage('Import Projects') {
steps {
sh 'ccstudio -noSplash -data . -application com.ti.ccstudio.apps.projectImport -ccs.location els-f280049c || true'
sh 'ccstudio -noSplash -data . -application com.ti.ccstudio.apps.projectImport -ccs.location testfixture-f280049c || true'
}
}

Expand Down
15 changes: 13 additions & 2 deletions els-f280049c/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@



//================================================================================
// HARDWARE
//
// Define which hardware you're using:
//
// 1 - LaunchXL F280049C with ELS BoostXL v1
// 2 - LaunchXL F280049C with ELS BoostXL v2
//================================================================================

// See hardware version table above
#define HARDWARE_VERSION 2


//================================================================================
// CPU / TIMING
//
Expand All @@ -119,6 +132,4 @@
#define CPU_CLOCK_HZ (CPU_CLOCK_MHZ * 1000000)




#endif // __CONFIGURATION_H
50 changes: 37 additions & 13 deletions els-f280049c/EEPROM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void EEPROM :: configureSpiBus8Bit( void )
{
// configure the shared bus
this->spiBus->setFourWire();
this->spiBus->setSixteenBits();
this->spiBus->setEightBits();
}

void EEPROM :: configureSpiBus16Bit( void )
Expand Down Expand Up @@ -101,26 +101,56 @@ void EEPROM :: waitForWriteCycle(void)

void EEPROM :: sendReadCommand(Uint16 blockNumber)
{
configureSpiBus16Bit();

Uint16 command = 0b0000001100000000; // read
Uint16 address = blockNumber << 4;
Uint16 command = 0b0000001100000000 + // read

#ifdef EEPROM_CHIP_25AA040A
// combine the address with the command
command +=
(address & 0b0000000011111111) + // bits 0-7 of address
((address & 0b0000000100000000) << 3); // bit 8 of address

// send the command-address
configureSpiBus16Bit();
this->spiBus->sendWord(command);
#endif

#ifdef EEPROM_CHIP_AT25080B
// send the command
configureSpiBus8Bit();
this->spiBus->sendWord(command);

// send the address
configureSpiBus16Bit();
this->spiBus->sendWord(address);
#endif
}

void EEPROM :: sendWriteCommand(Uint16 blockNumber)
{
configureSpiBus16Bit();

Uint16 command = 0b0000001000000000; // write
Uint16 address = blockNumber << 4;
Uint16 command = 0b0000001000000000 + // write

#ifdef EEPROM_CHIP_25AA040A
// combine the address with the command
command +=
(address & 0b0000000011111111) + // bits 0-7 of address
((address & 0b0000000100000000) << 3); // bit 8 of address

// send the command-address
configureSpiBus16Bit();
this->spiBus->sendWord(command);
#endif

#ifdef EEPROM_CHIP_AT25080B
// send the command
configureSpiBus8Bit();
this->spiBus->sendWord(command);

// send the address
configureSpiBus16Bit();
this->spiBus->sendWord(address);
#endif
}

void EEPROM :: receivePage(Uint16 pageSize, Uint16 *buffer)
Expand All @@ -143,9 +173,6 @@ void EEPROM :: sendPage(Uint16 pageSize, Uint16 *buffer)

bool EEPROM :: readPage(Uint16 pageNum, Uint16 *buffer)
{
this->spiBus->setSixteenBits();
this->spiBus->setFourWire();

CS_ASSERT;
sendReadCommand(pageNum);
receivePage(EEPROM_PAGE_SIZE, buffer);
Expand All @@ -157,9 +184,6 @@ bool EEPROM :: readPage(Uint16 pageNum, Uint16 *buffer)

bool EEPROM :: writePage(Uint16 pageNum, Uint16 *buffer)
{
this->spiBus->setSixteenBits();
this->spiBus->setFourWire();

setWriteLatch();

CS_ASSERT;
Expand Down
11 changes: 11 additions & 0 deletions els-f280049c/EEPROM.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@

#include "F28x_Project.h"
#include "SPIBus.h"
#include "Configuration.h"

#if HARDWARE_VERSION == 1
# define EEPROM_CHIP_25AA040A
#elif HARDWARE_VERSION == 2
# define EEPROM_CHIP_AT25080B
#else
# error Must define a valid HARDWARE_VERSION
#endif



#define EEPROM_PAGE_SIZE 8 // 2-byte words

Expand Down
6 changes: 4 additions & 2 deletions els-f280049c/SPIBus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

SPIBus :: SPIBus( void )
{

mask = 0xffff;
}

void SPIBus :: initHardware(void)
Expand Down Expand Up @@ -55,11 +55,13 @@ void SPIBus :: setFourWire( void )
void SPIBus :: setEightBits( void )
{
SpibRegs.SPICCR.bit.SPICHAR = 0x7; // 8 bits
mask = 0x00ff; // set the mask to 8 bits
}

void SPIBus :: setSixteenBits( void )
{
SpibRegs.SPICCR.bit.SPICHAR = 0xF; // 16 bits
mask = 0xffff; // set the mask to 16 bits
}

void SPIBus :: sendWord(Uint16 data)
Expand All @@ -74,7 +76,7 @@ Uint16 SPIBus :: receiveWord(void) {
SpibRegs.SPICTL.bit.TALK = 0;
SpibRegs.SPITXBUF = dummy;
WAIT_FOR_SERIAL;
return SpibRegs.SPIRXBUF;
return SpibRegs.SPIRXBUF & mask; // mask off if we're in 8-bit mode
}


Expand Down
3 changes: 3 additions & 0 deletions els-f280049c/SPIBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class SPIBus
// dummy register, for SPI
Uint16 dummy;

// mask used to discard high bits on receive
Uint16 mask;

public:
SPIBus(void);

Expand Down
2 changes: 1 addition & 1 deletion els-f280049c/UserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

const MESSAGE STARTUP_MESSAGE_2 =
{
.message = { LETTER_E, LETTER_L, LETTER_S, DASH, ONE | POINT, ZERO | POINT, ZERO, THREE },
.message = { LETTER_E, LETTER_L, LETTER_S, DASH, ONE | POINT, ONE | POINT, ZERO, ZERO },
.displayTime = UI_REFRESH_RATE_HZ * 1.5
};

Expand Down
17 changes: 17 additions & 0 deletions testfixture-f280049c/.ccsproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?ccsproject version="1.0"?>
<projectOptions>
<ccsVersion value="9.0.0"/>
<deviceVariant value="TMS320C28XX.TMS320F280049C"/>
<deviceFamily value="C2000"/>
<deviceEndianness value="little"/>
<codegenToolVersion value="18.12.1.LTS"/>
<isElfFormat value="false"/>
<connection value="common/targetdb/connections/TIXDS110_Connection.xml"/>
<linkerCommandFile value="280049C_RAM_lnk.cmd"/>
<rts value="libc.a"/>
<createSlaveProjects value=""/>
<templateProperties value="id=com.ti.common.project.core.emptyProjectWithMainTemplate"/>
<filesToOpen value="main.c"/>
<isTargetManual value="false"/>
</projectOptions>
Loading

0 comments on commit 540bce6

Please sign in to comment.