в реальной схеме на микросхему BL25CM1A на CS приходит сигнал с порта GPIO15, на котором нет ф-ции CS для SPI.
в связи с этим реализована программная ф-я чипселекта для BL25CM1A, а для GD оставлен аппаратный CS на GPIO35
This commit is contained in:
parent
68f6585f9a
commit
793d9c775a
@ -91,7 +91,7 @@ void GpioInit(void)
|
||||
// GpioDataRegs.GPADAT.bit.GPIO21 = out_bit;
|
||||
//}
|
||||
|
||||
void Gpio15out(uint16_t out_bit)
|
||||
void Gpio15outSPI_CS_BL25CM1A(uint16_t out_bit)
|
||||
{
|
||||
GpioDataRegs.GPADAT.bit.GPIO15 = out_bit;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
void GpioInit(void);
|
||||
//void Gpio20out(uint16_t out_bit);
|
||||
//void Gpio21out(uint16_t out_bit);
|
||||
void Gpio15out(uint16_t out_bit);
|
||||
void Gpio15outSPI_CS_BL25CM1A(uint16_t out_bit);
|
||||
void Gpio54out(uint16_t out_bit);
|
||||
void Gpio55out(uint16_t out_bit);
|
||||
void Gpio56out(uint16_t out_bit);
|
||||
|
@ -356,10 +356,10 @@ sdfm_check_all_current_measurements_was_done(void)
|
||||
{
|
||||
if((sdfmIndex & SDFM_ALL_CURRENTS) == SDFM_ALL_CURRENTS)
|
||||
{
|
||||
Gpio15out(1);
|
||||
Gpio15outSPI_CS_BL25CM1A(1);
|
||||
sdfmIndex = 0;
|
||||
vectorControl(sdfmAdc[SDFM_IA],sdfmAdc[SDFM_IB],sdfmAdc[SDFM_IC]);
|
||||
Gpio15out(0);
|
||||
Gpio15outSPI_CS_BL25CM1A(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ void SpiAGpioInit(void)
|
||||
EDIS;
|
||||
}
|
||||
|
||||
void transmitAData(uint16_t a)
|
||||
void spi_transmitAData(uint16_t a)
|
||||
{
|
||||
SpiaRegs.SPITXBUF = a<<8;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
void SpiAGpioInit(void);
|
||||
void SpiAInit(void);
|
||||
void transmitAData(uint16_t a);
|
||||
void spi_transmitAData(uint16_t a);
|
||||
|
||||
void SpiBGpioInit(void);
|
||||
void SpiBInit(void);
|
||||
@ -31,7 +31,7 @@ void transmitBData(uint16_t a);
|
||||
|
||||
#define SpiGpioInit SpiAGpioInit
|
||||
#define SpiInit SpiAInit
|
||||
#define transmitData transmitAData
|
||||
#define transmitData spi_transmitAData
|
||||
#define SpiRegs SpiaRegs
|
||||
|
||||
#endif
|
||||
|
@ -87,7 +87,6 @@ uint32_t InCommand,InAddr,InData;
|
||||
// IPC ISR for Flag 1
|
||||
// C28x core sends data with message queue using Flag 0
|
||||
//
|
||||
uint16_t offset = 0;
|
||||
|
||||
void FillBuff1(void)
|
||||
{
|
||||
@ -96,10 +95,10 @@ void FillBuff1(void)
|
||||
|
||||
for(i=0; i < 2048; i++)
|
||||
{
|
||||
|
||||
j = (i+offset) & 0x7F;
|
||||
j = i & 0x7F;
|
||||
a = (2*j<<8);
|
||||
b = (2*j+1);
|
||||
//Buffer = (uint16_t *)(CMTOCPU1MSGRAM0_BASE+2*i);
|
||||
Buffer[i] = a+b;
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//CPU1_FLASH/Freemaster/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/Freemaster/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/driverlib/ccs/Debug/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/driverlib/ccs/Debug/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/driverlib/ccs/Release/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/driverlib/ccs/Release/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/driverlib/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/driverlib/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/lib/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/lib/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/makefile=UTF-8
|
||||
encoding//CPU1_FLASH/objects.mk=UTF-8
|
||||
encoding//CPU1_FLASH/sources.mk=UTF-8
|
||||
encoding//CPU1_FLASH/src/ExternalEEPROM/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/src/ExternalEEPROM/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/src/Lib/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/src/Lib/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/src/Peripherals/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/src/Peripherals/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/src/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/src/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_RAM/Freemaster/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_RAM/Freemaster/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_RAM/device/driverlib/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_RAM/device/driverlib/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_RAM/device/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_RAM/device/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_RAM/lib/subdir_rules.mk=UTF-8
|
||||
@ -43,26 +16,3 @@ encoding//CPU1_RAM/src/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_RAM/src/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_RAM/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_RAM/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/Freemaster/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/Freemaster/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/device/driverlib/ccs/Debug/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/device/driverlib/ccs/Debug/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/device/driverlib/ccs/Release/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/device/driverlib/ccs/Release/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/device/driverlib/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/device/driverlib/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/device/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/device/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/lib/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/lib/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/makefile=UTF-8
|
||||
encoding//CPU2_RAM/objects.mk=UTF-8
|
||||
encoding//CPU2_RAM/sources.mk=UTF-8
|
||||
encoding//CPU2_RAM/src/ExternalEEPROM/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/src/ExternalEEPROM/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/src/Peripherals/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/src/Peripherals/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/src/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/src/subdir_vars.mk=UTF-8
|
||||
encoding//CPU2_RAM/subdir_rules.mk=UTF-8
|
||||
encoding//CPU2_RAM/subdir_vars.mk=UTF-8
|
||||
|
@ -28,23 +28,27 @@
|
||||
void Bl25cm1a_en(void)
|
||||
{
|
||||
volatile uint16_t empty;
|
||||
Gpio15outSPI_CS_BL25CM1A(0);
|
||||
transmitData(WREN);
|
||||
while(SpiRegs.SPIFFRX.bit.RXFFST != 1)
|
||||
{
|
||||
|
||||
}
|
||||
Gpio15outSPI_CS_BL25CM1A(1);
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
}
|
||||
|
||||
uint16_t Bl25cm1a_ReadStatus(void)
|
||||
{
|
||||
volatile uint16_t empty;
|
||||
Gpio15outSPI_CS_BL25CM1A(0);
|
||||
transmitData(RDSR);
|
||||
transmitData(0xFF);
|
||||
while(SpiRegs.SPIFFRX.bit.RXFFST != 2)
|
||||
{
|
||||
|
||||
}
|
||||
Gpio15outSPI_CS_BL25CM1A(1);
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
return empty;
|
||||
@ -60,7 +64,7 @@ void Bl25cm1a_read_8_bytes(uint32_t Addr, uint16_t * read_data, uint16_t num_byt
|
||||
{
|
||||
Stat = Bl25cm1a_ReadStatus();
|
||||
}
|
||||
|
||||
Gpio15outSPI_CS_BL25CM1A(0);
|
||||
transmitData(READ);
|
||||
transmitData(Addr>>16);
|
||||
transmitData(Addr>>8);
|
||||
@ -70,6 +74,7 @@ void Bl25cm1a_read_8_bytes(uint32_t Addr, uint16_t * read_data, uint16_t num_byt
|
||||
{
|
||||
|
||||
}
|
||||
Gpio15outSPI_CS_BL25CM1A(1);
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
@ -92,7 +97,7 @@ void Bl25cm1a_write_8_bytes(uint32_t Addr, uint16_t * write_data, uint16_t num_b
|
||||
}
|
||||
|
||||
Bl25cm1a_en();
|
||||
|
||||
Gpio15outSPI_CS_BL25CM1A(0);
|
||||
transmitData(WRITE);
|
||||
transmitData(Addr>>16);
|
||||
transmitData(Addr>>8);
|
||||
@ -102,6 +107,7 @@ void Bl25cm1a_write_8_bytes(uint32_t Addr, uint16_t * write_data, uint16_t num_b
|
||||
{
|
||||
|
||||
}
|
||||
Gpio15outSPI_CS_BL25CM1A(1);
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
@ -122,7 +128,7 @@ uint16_t Bl25cm1a_verify_8_bytes(uint32_t Addr, uint16_t * verify_data, uint16_
|
||||
{
|
||||
Stat = Bl25cm1a_ReadStatus();
|
||||
}
|
||||
|
||||
Gpio15outSPI_CS_BL25CM1A(0);
|
||||
transmitData(READ);
|
||||
transmitData(Addr>>16);
|
||||
transmitData(Addr>>8);
|
||||
@ -132,6 +138,7 @@ uint16_t Bl25cm1a_verify_8_bytes(uint32_t Addr, uint16_t * verify_data, uint16_
|
||||
{
|
||||
|
||||
}
|
||||
Gpio15outSPI_CS_BL25CM1A(1);
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
empty = SpiRegs.SPIRXBUF;
|
||||
|
@ -19,10 +19,6 @@ void GpioInit(void)
|
||||
// GpioCtrlRegs.GPADIR.bit.GPIO21 = 1;
|
||||
// GpioDataRegs.GPADAT.bit.GPIO21 = 0;
|
||||
|
||||
GpioCtrlRegs.GPAMUX1.bit.GPIO15 = 0;
|
||||
GpioCtrlRegs.GPAGMUX1.bit.GPIO15 = 0;
|
||||
GpioCtrlRegs.GPADIR.bit.GPIO15 = 1;
|
||||
GpioDataRegs.GPADAT.bit.GPIO15 = 0;
|
||||
|
||||
GpioCtrlRegs.GPBMUX2.bit.GPIO54 = 0;
|
||||
GpioCtrlRegs.GPBGMUX2.bit.GPIO54 = 0;
|
||||
@ -91,10 +87,6 @@ void GpioInit(void)
|
||||
// GpioDataRegs.GPADAT.bit.GPIO21 = out_bit;
|
||||
//}
|
||||
|
||||
void Gpio15out(uint16_t out_bit)
|
||||
{
|
||||
GpioDataRegs.GPADAT.bit.GPIO15 = out_bit;
|
||||
}
|
||||
|
||||
void Gpio54out(uint16_t out_bit)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
void GpioInit(void);
|
||||
//void Gpio20out(uint16_t out_bit);
|
||||
//void Gpio21out(uint16_t out_bit);
|
||||
void Gpio15out(uint16_t out_bit);
|
||||
|
||||
void Gpio54out(uint16_t out_bit);
|
||||
void Gpio55out(uint16_t out_bit);
|
||||
void Gpio56out(uint16_t out_bit);
|
||||
|
@ -209,6 +209,7 @@ void getMessage_from_Cm_BL25CM1A(void)
|
||||
if((InAddr+InData) > BL25CM1A0_SIZE) {IPC_sendCommand(IPC_CPU1_L_CM_R, WRONG_ADDR, BL25CM1A_1M_bit_SPI, 0, 0); return;}
|
||||
IPC_sendCommand(IPC_CPU1_L_CM_R, COMMAND_ACCEPTED, BL25CM1A_1M_bit_SPI, 0, 0);
|
||||
|
||||
spi_TurnOffCS1_GD25Q16E();
|
||||
switch(InCommand >> 16)
|
||||
{
|
||||
case READ:
|
||||
@ -240,6 +241,9 @@ void getMessage_from_Cm_GD25Q16E(void)
|
||||
if((InAddr+InData) > GD25Q16E_SIZE) {IPC_sendCommand(IPC_CPU1_L_CM_R, WRONG_ADDR, GD25Q16E_16M_bit_SPI, 0, 0); return;}
|
||||
IPC_sendCommand(IPC_CPU1_L_CM_R, COMMAND_ACCEPTED, GD25Q16E_16M_bit_SPI, 0, 0);
|
||||
|
||||
Gpio15outSPI_CS_BL25CM1A(1);
|
||||
spi_TurnOnCS1_GD25Q16E();
|
||||
|
||||
switch(InCommand >> 16)
|
||||
{
|
||||
case READ:
|
||||
@ -263,6 +267,7 @@ void getMessage_from_Cm_GD25Q16E(void)
|
||||
GD25Q16ETIGR_clean_SectorWasErraised();
|
||||
break;
|
||||
}
|
||||
spi_TurnOffCS1_GD25Q16E();
|
||||
}
|
||||
|
||||
void getMessage_from_Cm_ZD24C02A(void)
|
||||
|
@ -86,20 +86,20 @@ void SpiAGpioInit(void)
|
||||
// Pull-ups can be enabled or disabled by the user.
|
||||
// This will enable the pullups for the specified pins.
|
||||
//
|
||||
GpioCtrlRegs.GPBPUD.bit.GPIO32 = 0; // Enable pull-up on GPIO16 (SPISIMOA)
|
||||
GpioCtrlRegs.GPBPUD.bit.GPIO33 = 0; // Enable pull-up on GPIO17 (SPISOMIA)
|
||||
GpioCtrlRegs.GPBPUD.bit.GPIO34 = 0; // Enable pull-up on GPIO18 (SPICLKA)
|
||||
GpioCtrlRegs.GPBPUD.bit.GPIO35 = 0; // Enable pull-up on GPIO19 (SPISTEA)
|
||||
GpioCtrlRegs.GPBPUD.bit.GPIO32 = 0; // Enable pull-up on (SPISIMOA)
|
||||
GpioCtrlRegs.GPBPUD.bit.GPIO33 = 0; // Enable pull-up on (SPISOMIA)
|
||||
GpioCtrlRegs.GPBPUD.bit.GPIO34 = 0; // Enable pull-up on (SPICLKA)
|
||||
GpioCtrlRegs.GPBPUD.bit.GPIO35 = 0; // Enable pull-up on (SPISTEA)
|
||||
|
||||
//
|
||||
// Set qualification for selected pins to asynch only
|
||||
//
|
||||
// This will select asynch (no qualification) for the selected pins.
|
||||
//
|
||||
GpioCtrlRegs.GPBQSEL1.bit.GPIO32 = 3; // Asynch input GPIO16 (SPISIMOA)
|
||||
GpioCtrlRegs.GPBQSEL1.bit.GPIO33 = 3; // Asynch input GPIO17 (SPISOMIA)
|
||||
GpioCtrlRegs.GPBQSEL1.bit.GPIO34 = 3; // Asynch input GPIO18 (SPICLKA)
|
||||
GpioCtrlRegs.GPBQSEL1.bit.GPIO35 = 3; // Asynch input GPIO19 (SPISTEA)
|
||||
GpioCtrlRegs.GPBQSEL1.bit.GPIO32 = 3; // Asynch input (SPISIMOA)
|
||||
GpioCtrlRegs.GPBQSEL1.bit.GPIO33 = 3; // Asynch input (SPISOMIA)
|
||||
GpioCtrlRegs.GPBQSEL1.bit.GPIO34 = 3; // Asynch input (SPICLKA)
|
||||
GpioCtrlRegs.GPBQSEL1.bit.GPIO35 = 3; // Asynch input (SPISTEA)
|
||||
|
||||
//
|
||||
// Configure SPI-A pins
|
||||
@ -107,15 +107,39 @@ void SpiAGpioInit(void)
|
||||
// This specifies which of the possible GPIO pins will be SPI functional
|
||||
// pins.
|
||||
//
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 3; // Configure GPIO16 as SPISIMOA
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 3; // Configure GPIO17 as SPISOMIA
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 3; // Configure GPIO18 as SPICLKA
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 3; // Configure GPIO19 as SPISTEA
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 3; // Configure GPIO32 as SPISIMOA
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 3; // Configure GPIO33 as SPISOMIA
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 3; // Configure GPIO34 as SPICLKA
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 3; // Configure GPIO35 as SPISTEA
|
||||
|
||||
|
||||
GpioCtrlRegs.GPAMUX1.bit.GPIO15 = 0;//program CS for BL25CM1A
|
||||
GpioCtrlRegs.GPAGMUX1.bit.GPIO15 = 0;
|
||||
GpioCtrlRegs.GPADIR.bit.GPIO15 = 1;
|
||||
GpioDataRegs.GPADAT.bit.GPIO15 = 0;
|
||||
|
||||
EDIS;
|
||||
}
|
||||
|
||||
void transmitAData(uint16_t a)
|
||||
|
||||
void spi_TurnOnCS1_GD25Q16E(void)
|
||||
{
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 3; // Configure GPIO35 as SPISTEA
|
||||
}
|
||||
|
||||
void spi_TurnOffCS1_GD25Q16E(void)
|
||||
{
|
||||
GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 0;
|
||||
GpioDataRegs.GPBDAT.bit.GPIO35 = 1;
|
||||
}
|
||||
|
||||
void Gpio15outSPI_CS_BL25CM1A(uint16_t out_bit)
|
||||
{
|
||||
GpioDataRegs.GPADAT.bit.GPIO15 = out_bit;
|
||||
}
|
||||
|
||||
|
||||
void spi_transmitAData(uint16_t a)
|
||||
{
|
||||
SpiaRegs.SPITXBUF = a<<8;
|
||||
}
|
||||
|
@ -12,12 +12,16 @@
|
||||
|
||||
void SpiAGpioInit(void);
|
||||
void SpiAInit(void);
|
||||
void transmitAData(uint16_t a);
|
||||
void spi_transmitAData(uint16_t a);
|
||||
|
||||
void SpiBGpioInit(void);
|
||||
void SpiBInit(void);
|
||||
void transmitBData(uint16_t a);
|
||||
|
||||
void Gpio15outSPI_CS_BL25CM1A(uint16_t out_bit);
|
||||
void spi_TurnOnCS1_GD25Q16E(void);
|
||||
void spi_TurnOnCS1_GD25Q16E(void);
|
||||
|
||||
|
||||
|
||||
#ifdef ExtEEPROM_SPIB
|
||||
@ -31,7 +35,7 @@ void transmitBData(uint16_t a);
|
||||
|
||||
#define SpiGpioInit SpiAGpioInit
|
||||
#define SpiInit SpiAInit
|
||||
#define transmitData transmitAData
|
||||
#define transmitData spi_transmitAData
|
||||
#define SpiRegs SpiaRegs
|
||||
|
||||
#endif
|
||||
|
@ -63,6 +63,7 @@ void InitPerif(void)
|
||||
//
|
||||
#ifdef CPU1
|
||||
GpioInit();
|
||||
Gpio15outSPI_CS_BL25CM1A(1);
|
||||
SpiInit();
|
||||
I2CMasterInit(I2C_OWN_ADDRESS,I2C_SLAVE_ADDRESS);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user