Other Parts Discussed in Thread: HALCOGEN
Dear All,
TMS570LC have only 2 ports(A & B) for GPIO and each port having 8 pins mean only 2*8 pins are available for GPIO output,
My requirement is of 40 GPIOs So I try to use Peripherals pins as GPIO
I want to use SPI3-MOSI pin as GPIO for that I made some changes as below
/---------------------------------------------------------------------------------------------------------
int main(void)
{
gioInit();
spiInit();
dataconfig1_t.CS_HOLD = 1;
dataconfig1_t.WDEL = FALSE;
gioToggleBit(gioPORTB, 7); // LED
gioToggleBit(gioPORTB, 6); // LED
spiREG3->PC0 &= ~(0x00FF0000); //MoSI as GPIO
spiREG3->PC1 |= 0x00FF0000; // Direction as OUTPUT
while(1)
{
spiREG3->PC3 |= (1 << SPI_PIN_SIMO_3); // Set as HIGH
delay_v();
spiREG3->PC3 &= ~(1 << SPI_PIN_SIMO_3); // Set as LOW
delay_v();
gioToggleBit(gioPORTB, 7); // LED
gioToggleBit(gioPORTB, 6); // LED
delay_v();
}/* USER CODE END */
return 0;
}
-------------------------------------------------------------------------------------/
Above code is generated from HALCoGen software
In which SPI is initilize and try to set MOSI as GPIO as per SFR
PROBLEM - MOSI pin remain in HIGH state only its not working as per requirements
So kindly let me know the Correct way to implement the logic