изменился чипселект на новой схеме

This commit is contained in:
seklyuts 2023-12-27 14:46:55 +03:00
parent 65f17dc051
commit 1e0ea8d2cc
7 changed files with 37 additions and 19 deletions

View File

@ -28,27 +28,27 @@
void Bl25cm1a_en(void) void Bl25cm1a_en(void)
{ {
volatile uint16_t empty; volatile uint16_t empty;
Gpio15outSPI_CS_BL25CM1A(0); Gpio_SPI_CS_BL25CM1A(0);
transmitData(WREN); transmitData(WREN);
while(SpiRegs.SPIFFRX.bit.RXFFST != 1) while(SpiRegs.SPIFFRX.bit.RXFFST != 1)
{ {
} }
Gpio15outSPI_CS_BL25CM1A(1); Gpio_SPI_CS_BL25CM1A(1);
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
} }
uint16_t Bl25cm1a_ReadStatus(void) uint16_t Bl25cm1a_ReadStatus(void)
{ {
volatile uint16_t empty; volatile uint16_t empty;
Gpio15outSPI_CS_BL25CM1A(0); Gpio_SPI_CS_BL25CM1A(0);
transmitData(RDSR); transmitData(RDSR);
transmitData(0xFF); transmitData(0xFF);
while(SpiRegs.SPIFFRX.bit.RXFFST != 2) while(SpiRegs.SPIFFRX.bit.RXFFST != 2)
{ {
} }
Gpio15outSPI_CS_BL25CM1A(1); Gpio_SPI_CS_BL25CM1A(1);
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
return empty; return empty;
@ -64,7 +64,7 @@ void Bl25cm1a_read_8_bytes(uint32_t Addr, uint16_t * read_data, uint16_t num_byt
{ {
Stat = Bl25cm1a_ReadStatus(); Stat = Bl25cm1a_ReadStatus();
} }
Gpio15outSPI_CS_BL25CM1A(0); Gpio_SPI_CS_BL25CM1A(0);
transmitData(READ); transmitData(READ);
transmitData(Addr>>16); transmitData(Addr>>16);
transmitData(Addr>>8); transmitData(Addr>>8);
@ -74,7 +74,7 @@ void Bl25cm1a_read_8_bytes(uint32_t Addr, uint16_t * read_data, uint16_t num_byt
{ {
} }
Gpio15outSPI_CS_BL25CM1A(1); Gpio_SPI_CS_BL25CM1A(1);
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
@ -97,7 +97,7 @@ void Bl25cm1a_write_8_bytes(uint32_t Addr, uint16_t * write_data, uint16_t num_b
} }
Bl25cm1a_en(); Bl25cm1a_en();
Gpio15outSPI_CS_BL25CM1A(0); Gpio_SPI_CS_BL25CM1A(0);
transmitData(WRITE); transmitData(WRITE);
transmitData(Addr>>16); transmitData(Addr>>16);
transmitData(Addr>>8); transmitData(Addr>>8);
@ -107,7 +107,7 @@ void Bl25cm1a_write_8_bytes(uint32_t Addr, uint16_t * write_data, uint16_t num_b
{ {
} }
Gpio15outSPI_CS_BL25CM1A(1); Gpio_SPI_CS_BL25CM1A(1);
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
@ -129,7 +129,7 @@ uint16_t Bl25cm1a_verify_8_bytes(uint32_t Addr, uint16_t * verify_data, uint16_
{ {
Stat = Bl25cm1a_ReadStatus(); Stat = Bl25cm1a_ReadStatus();
} }
Gpio15outSPI_CS_BL25CM1A(0); Gpio_SPI_CS_BL25CM1A(0);
transmitData(READ); transmitData(READ);
transmitData(Addr>>16); transmitData(Addr>>16);
transmitData(Addr>>8); transmitData(Addr>>8);
@ -139,7 +139,7 @@ uint16_t Bl25cm1a_verify_8_bytes(uint32_t Addr, uint16_t * verify_data, uint16_
{ {
} }
Gpio15outSPI_CS_BL25CM1A(1); Gpio_SPI_CS_BL25CM1A(1);
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;
empty = SpiRegs.SPIRXBUF; empty = SpiRegs.SPIRXBUF;

View File

@ -252,7 +252,7 @@ void getMessage_from_Cm_GD25Q16E(void)
if((InAddr+InData) > (GD25Q16E_SIZE*2)) {IPC_sendCommand(IPC_CPU1_L_CM_R, WRONG_ADDR, GD25Q16E_16M_bit_SPI, 0, 0); return;} if((InAddr+InData) > (GD25Q16E_SIZE*2)) {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); IPC_sendCommand(IPC_CPU1_L_CM_R, COMMAND_ACCEPTED, GD25Q16E_16M_bit_SPI, 0, 0);
Gpio15outSPI_CS_BL25CM1A(1); Gpio_SPI_CS_BL25CM1A(1);
spi_TurnOnCS1_GD25Q16E(); spi_TurnOnCS1_GD25Q16E();
switch(InCommand >> 16) switch(InCommand >> 16)

View File

@ -7,6 +7,12 @@
#include "f28x_project.h" #include "f28x_project.h"
#define SPI_PROGRAM_CS_GPAMUX1 GpioCtrlRegs.GPDMUX1.bit.GPIO98
#define SPI_PROGRAM_CS_GPAGMUX1 GpioCtrlRegs.GPDGMUX1.bit.GPIO98
#define SPI_PROGRAM_CS_GPADIR GpioCtrlRegs.GPDDIR.bit.GPIO98
#define SPI_PROGRAM_CS_GPADAT GpioDataRegs.GPDDAT.bit.GPIO98
__interrupt void spia_rx_isr(void); __interrupt void spia_rx_isr(void);
__interrupt void spia_tx_isr(void); __interrupt void spia_tx_isr(void);
@ -113,10 +119,10 @@ void SpiAGpioInit(void)
GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 3; // Configure GPIO35 as SPISTEA GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 3; // Configure GPIO35 as SPISTEA
GpioCtrlRegs.GPAMUX1.bit.GPIO15 = 0;//program CS for BL25CM1A SPI_PROGRAM_CS_GPAMUX1 = 0;//program CS for BL25CM1A
GpioCtrlRegs.GPAGMUX1.bit.GPIO15 = 0; SPI_PROGRAM_CS_GPAGMUX1 = 0;
GpioCtrlRegs.GPADIR.bit.GPIO15 = 1; SPI_PROGRAM_CS_GPADIR = 1;
GpioDataRegs.GPADAT.bit.GPIO15 = 0; SPI_PROGRAM_CS_GPADAT = 0;
EDIS; EDIS;
} }
@ -137,10 +143,10 @@ void spi_TurnOffCS1_GD25Q16E(void)
EDIS; EDIS;
} }
void Gpio15outSPI_CS_BL25CM1A(uint16_t out_bit) void Gpio_SPI_CS_BL25CM1A(uint16_t out_bit)
{ {
EALLOW; EALLOW;
GpioDataRegs.GPADAT.bit.GPIO15 = out_bit; SPI_PROGRAM_CS_GPADAT = out_bit;
EDIS; EDIS;
} }

View File

@ -18,7 +18,7 @@ void SpiBGpioInit(void);
void SpiBInit(void); void SpiBInit(void);
void transmitBData(uint16_t a); void transmitBData(uint16_t a);
void Gpio15outSPI_CS_BL25CM1A(uint16_t out_bit); void Gpio_SPI_CS_BL25CM1A(uint16_t out_bit);
void spi_TurnOnCS1_GD25Q16E(void); void spi_TurnOnCS1_GD25Q16E(void);
void spi_TurnOffCS1_GD25Q16E(void); void spi_TurnOffCS1_GD25Q16E(void);

View File

@ -63,7 +63,7 @@ void InitPerif(void)
// //
#ifdef CPU1 #ifdef CPU1
GpioInit(); GpioInit();
Gpio15outSPI_CS_BL25CM1A(1); Gpio_SPI_CS_BL25CM1A(1);
SpiInit(); SpiInit();
I2CMasterInit(I2C_OWN_ADDRESS,I2C_SLAVE_ADDRESS); I2CMasterInit(I2C_OWN_ADDRESS,I2C_SLAVE_ADDRESS);
#endif #endif

Binary file not shown.

View File

@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.ti.ccstudio.debug.launchType.device.debugging"> <launchConfiguration type="com.ti.ccstudio.debug.launchType.device.debugging">
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.TMS320F28388D.ccxml.Texas Instruments XDS100v2 USB Debug Probe_0/Cortex_M4_0" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot; ?&gt;&#10;&lt;PropertyValues&gt;&#10;&#10; &lt;property id=&quot;ConnectOnStartup&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;EnableInstalledBreakpoint&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;IgnoreSoftLaunchFailures&quot;&gt;&#10; &lt;curValue&gt;0&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10;&lt;/PropertyValues&gt;&#10;"/> <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.TMS320F28388D.ccxml.Texas Instruments XDS100v2 USB Debug Probe_0/Cortex_M4_0" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot; ?&gt;&#10;&lt;PropertyValues&gt;&#10;&#10; &lt;property id=&quot;ConnectOnStartup&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;EnableInstalledBreakpoint&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;IgnoreSoftLaunchFailures&quot;&gt;&#10; &lt;curValue&gt;0&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10;&lt;/PropertyValues&gt;&#10;"/>
<setAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_HIDE_CONFIG_ELEMENT_TYPES">
<setEntry value="BOARD"/>
<setEntry value="BYPASSED_CPU"/>
<setEntry value="BYPASSED_ROUTER"/>
<setEntry value="CONNECTION"/>
<setEntry value="DEVICE"/>
<setEntry value="NON_DEBUG_CPU"/>
<setEntry value="NO_DRIVER"/>
<setEntry value="ROUTER"/>
<setEntry value="SUBPATH"/>
<setEntry value="SYSTEM"/>
</setAttribute>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.TMS320F28388D.ccxml.Texas Instruments XDS100v2 USB Debug Probe_0/Cortex_M4_0" value="${build_artifact:ipc_ex2_msgqueue_cm}"/> <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.TMS320F28388D.ccxml.Texas Instruments XDS100v2 USB Debug Probe_0/Cortex_M4_0" value="${build_artifact:ipc_ex2_msgqueue_cm}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.TMS320F28388D.ccxml.Texas Instruments XDS100v2 USB Debug Probe_0/Cortex_M4_0" value="ipc_ex2_msgqueue_cm"/> <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.TMS320F28388D.ccxml.Texas Instruments XDS100v2 USB Debug Probe_0/Cortex_M4_0" value="ipc_ex2_msgqueue_cm"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:ipc_ex2_msgqueue_cm}"/> <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:ipc_ex2_msgqueue_cm}"/>