Other Parts Discussed in Thread: RF430FRL152H
Hello all,
I am now using RF430FRL152HEVM to communicate with another module that transfers data with the EVM in SPI protocol, in which I use pin1.0 to pin1.3.
Along with communication requirements, that module also needs another pin from MCU(in my project it should be RF430FRL152H) to output high or low level to reset the module. Considering that the RF430FRL152H only has 8 pins, and the left 4 pins are used in JTAG programming(in which way I load my code), I am figuring out how to release one of those pin from JTAG function and turn it into normal io port and output the intended level.
I have implemented my thought with the EVM(master in SPI) and MSP‑EXP430G2ET(slave in SPI), to test whether SPI communication and turning JTAG related pin into normal output port is workable. And I use the MSP‑EXP430G2ET to send received SPI data to the computer via UART.
Here are my code about how to turn pin 1.5 to output io port, and it works well when I use multimeter to test the voltage on pin 1.5.
void JTAGPinHigh(void)
{
asm ( " CALL #0x5CDA "); // Call ROM function ( Initialize function pointers)
asm ( " CALL #0x5CAC "); // Call ROM function ( Check part configuration)
/*P1.4-->JTAG_TCK, P1.5-->JTAG_TDI, P1.6-->JTAG_TDO, P1.7-->JTAG_TMS*/
P1SEL0 &= ~0xF0; //no JTAG
P1SEL1 &= ~0xF0; //no JTAG
P1DIR |= BIT5;//set pin1.5 as output
P1OUT |= BIT5;//set p1.5-TDI high
}
BUT problem comes when I use this function in my 'main' function. If I disable the JTAG function after the SPI communication, the data transmission has no wrong shown on the computer. But if I put this function before the SPI communication, the data shown on the computer is wrong.
In my code, master is sending 0x00 to 0x0F to the slave. The wrong data shows like'C0 57 F8 56 3A 4C 34 5B AC 5C 04 5B 20 59 52 5C ', and it shows up steadily if I restart the communication.
I would like to know how to fix this communication problem if I want to disable JTAG in the middle of my project. I have tried to add 'P1SEL0 |= 0xF0; P1SEL1 |= 0xF0;' to recover JTAG function, but it still shows wrong data.
Thank for your help in advance.
Huaxuan Cai