This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Issue: CC3100 pin conflict with P1.6 CBOUT and P2.2 TA2CLK on the MSP430F5529 Launch Pad
Goal: Map CBOUT to P4.1, and TBOCLK to P4.2 so that the Comparator can drive TimerB as a counter for use with the LMT01 temperature sensor in SYNC Comparator Mode.
Status: Code below compiles zero errors and runs but does NOT map the pins.
The F55229 Data Sheet page 57, chart 6-7 of the shows that Comparator_B output can either be mapped with PM_CBOUT0 value 0, or with PM_CBOUT1 value 17 and that the TimerB External clock in can be Port Mapped with PM_TB0CLK Value 1.
- Driver Library example maps P4MAP01? (Word) Is this the correct port to be mapping? Or should it be P4MAP0? (Byte)?
- See SLAU397 page 4 Table 1-3 Byte Access, and Table1-4 Word Access.
- Page 69 of the F55229 spec sheet Table 6-25 appears to imply that P4MAP0 to P4MAP7 should be used and that the Driver Library example is WRONG??
3. Why for Comparator_B is there PM_CBOUT0 and CBOUT1? There is only one Comparator_B in the F5529. (Mapping either 0 or 1 does not work.)
Option 1: Using “unsigned char” as the Driver Library doc example p 243 uses char
Compiles with ZERO errors, runs, does NOT map P4.1 and P4.2. WHY???
const unsigned char port_mapping[] = {
// Port P4
PM_NONE, // P4.0
PM_CBOUT1, // P4.1
PM_TB0CLK, // P4.2
PM_NONE, // P4.3
PM_NONE, // P4.4
PM_NONE, // P4.5
PM_NONE, // P4.6
PM_NONE // P4.7
};
PMAP_initPortsParam temperatureInitPortsParam =
{
(const unsigned char *)port_mapping,
(unsigned char*)&P4MAP01,
1,
PMAP_DISABLE_RECONFIGURATION
};
PMAP_initPorts(P4MAP_BASE, &temperatureInitPortsParam);
Option 2: Using “uint8_t” as the actual pmap.h code in the project uses this term
Compiles with ZERO errors, runs, does NOT map P4.1 and P4.2. WHY???
const uint8_t myP4Map[] = {
PM_NONE, // P4.0
PM_CBOUT1, // P4.1
PM_TB0CLK, // P4.2
PM_NONE, // P4.3
PM_NONE, // P4.4
PM_NONE, // P4.5
PM_NONE, // P4.6
PM_NONE // P4.7
};
};
PMAP_initPortsParam temperatureInitPortsParam =
{
(const uint8_t*)myP4Map,
(uint8_t*)&P4MAP01, //Both 0 and 01 compile OK, see Port Map Controller user Guide SLAU397 page 4 single digit for bytes, double digit for word
1,
PMAP_DISABLE_RECONFIGURATION
};
PMAP_initPorts(P4MAP_BASE, &temperatureInitPortsParam);
All help is greatly appreciated,
Engineer ...Lorne
Thanks Clemens for the reply.
Issue: CC3100 pin conflict with P1.6 CBOUT and P2.2 TA2CLK on the MSP430F5529 Launch Pad
Goal: Map CBOUT to P4.1, and TBOCLK to P4.2 so that the Comparator can drive TimerB as a counter for use with the LMT01 temperature sensor in SYNC Comparator Mode.
Status: Code below compiles with zero errors and runs but does NOT map the pins.
I have a couple thousand lines of C-code in my project with multiple timers, I/O, the comparator, and LMT01 temperature sensor all working perfectly. I am now trying to add the CC3100 WiFi module. I suspect I am extremely close to getting Port Mapping working. I am somehow just not changing the correct registers. I am an experienced EE but not experienced in micro registers so my apologies if the error is something trivial.
I have created a minimum CCS project that can be used to test out code solution options. I used the attach code to attach a ZIPPED working project with the Port Mapping Code ready to comment in or out.
Test setup required 1) MSP430F5529 launch pad and 2) one pin jumper wire.
The jumper wire is used to connect the CBOUT Pin 1.6 or the desired Port Mapped Pin P4.1 to the respective Timer External CLK in for either Timer_A2 TA2CLK P2.2 or the desired Timer_B0 P4.2.
Since you likely do not have an LMT01 temperature sensor to drive the Comparator_B positive input, I have created some test code that uses Comparator_B driver command “Comp_B_swapIO”. This causes the CBOUT to toggle simulating a pulse train from the LMT01.
The attached code works perfectly. It is currently “commented out” so that it works with the standard F5529 launch pad Peripheral Module function selection of CBOUT to P1.6 and TA2CLK to P2.2.
Build and run the code. Look at Expressions iTempAvgArray (5 elements) . Since the CBOUT is being toggled via the trick of the “Comp_B_swapIO”, the TA2CLK is being clocked, and these Counts are being read into the iTempAvgArray.
Steps to switch to using the Port Mapped CBOUT and TB0CLK.
GPIO_setAsPeripheralModuleFunctionOutputPin (GPIO_PORT_P1, GPIO_PIN6);
As we do not want CBOUT connected to P1.6
Port Mapping Start ***OPTION #1 using "unsigned char"
Port Mapping Start ***OPTION #2 using ""uint8_t"
P4.1 CBOUT Mapped with P2.2TA2CLK
One change at a time as if the CBOUT was successfully Mapped to P4.1 the Timer_A2 clock should now clock just like it did originally, but now with P4.1
***This is what does not work as CBOUT does not get Port Mapped to P4.1***
P4.1 CBOUT Mapped with P4.2 TB0CLK Mapped
- Mytimers.c toggle comment lines 300 to 345 to DISABLE the use of Timer_A2
- Mytimers.c toggle comment lines 347 to 390 to ENABLE the use of Timer_B0
***If Port Mapping works P4.1 CBOUT connected with a jumper to P4.2 TB0CLK will clock Timer_B0
Look at Expressions iTempAvgArray (5 elements) . Since the CBOUT is being toggled via the trick of the “Comp_B_swapIO”, the TB0CLK is being clocked, and these Counts are being read into the iTempAvgArray.
If you can get the Port Mapping to work, please send me back a Zipped CCS Project solution with the changes.
You will be our hero as several of us have tried to make the F5529 Port Mapping work.
Engineer ….LorneTI_Help_MSP430F5529_Port_Map_V1_8-9-2016.zip
Reply to old_cow_yellow
Thanks for the reply. There must be someone in TI or the TI community that at one time got the F5529 Port Mapping to work!!
I attached the complete CCS project file yesterday so will not attach it here again. If you need it let me know and I will resent it.
This is the actual code that does not work.
//***************Port Mapping Start ***OPTION #1 using "unsigned char" ***********
const unsigned char port_mapping[] = { // Drive library doc example p 243 uses char instead of uint
// Port P4
PM_NONE, // P4.0
PM_CBOUT1, // P4.1 PM_CBOUT0 or PM_CBOUT1 which ever will work
PM_TB0CLK, // P4.2
PM_NONE, // P4.3
PM_NONE, // P4.4
PM_NONE, // P4.5
PM_NONE, // P4.6
PM_NONE // P4.7
};
PMAP_initPortsParam temperatureInitPortsParam =
{
//! Is the pointer to init Data
(const unsigned char *)port_mapping, // Driver library douc example p243 uses character
//! Is the pointer start of first PMAP to initialize
(unsigned char*)&P4MAP01, //Driver library uses char and uses MAP01 vs just 0
// (uint8_t*)&P4MAP0, //Both 0 and 01 compile OK, see Port Map Controller user Guide SLAU397 page 4 single digit for bytes, double digit for word
//! Is the number of Ports to initialize
1,
//! Is used to enable/disable reconfiguration
//! \n Valid values are:
//! - \b PMAP_ENABLE_RECONFIGURATION
//! - \b PMAP_DISABLE_RECONFIGURATION [Default]
PMAP_DISABLE_RECONFIGURATION
};
PMAP_initPorts(P4MAP_BASE, &temperatureInitPortsParam);
GPIO_setAsPeripheralModuleFunctionOutputPin (GPIO_PORT_P4, GPIO_PIN1); //P4.1 to CBOUT1
GPIO_setAsPeripheralModuleFunctionInputPin (GPIO_PORT_P4, GPIO_PIN2); //P4.2 to TB0CLK
//*********End of ******Port Mapping Start ***OPTION #1 using "unsigned char" ***********
Looking at the actual pmap.h in my project suggests to me that it may want "uint8_t" so I also tried that.
//***************Port Mapping Start ***OPTION #2 using ""uint8_t"" ***********
// BOTH the use of "unsigned char" or "uint8_t" compile with no errors, but neither seem to change the Comparator B output to Pin 4.1
const uint8_t myP4Map[] = { //The actual pmap.h code in this project suggests/implies to use "uint8_t"
// Port P4
PM_NONE, // P4.0
PM_CBOUT1, // P4.1 PM_CBOUT0 or PM_CBOUT1 which ever will work
PM_TB0CLK, // P4.2
PM_NONE, // P4.3
PM_NONE, // P4.4
PM_NONE, // P4.5
PM_NONE, // P4.6
PM_NONE // P4.7
};
PMAP_initPortsParam temperatureInitPortsParam =
{
//! Is the pointer to init Data
(const uint8_t*)myP4Map, //The actual pmap.h code in this project suggests/implies to use "uint8_t"
//! Is the pointer start of first PMAP to initialize
(uint8_t*)&P4MAP0, //Both 0 and 01 compile OK, see Port Map Controller user Guide SLAU397 page 4 single digit for bytes, double digit for word
//! Is the number of Ports to initialize
1,
//! Is used to enable/disable reconfiguration
//! \n Valid values are:
//! - \b PMAP_ENABLE_RECONFIGURATION
//! - \b PMAP_DISABLE_RECONFIGURATION [Default]
PMAP_DISABLE_RECONFIGURATION
};
PMAP_initPorts(P4MAP_BASE, &temperatureInitPortsParam);
GPIO_setAsPeripheralModuleFunctionOutputPin (GPIO_PORT_P4, GPIO_PIN1); //P4.1 to CBOUT1
GPIO_setAsPeripheralModuleFunctionInputPin (GPIO_PORT_P4, GPIO_PIN2); //P4.2 to TB0CLK
//******End of *********Port Mapping Start ***OPTION #2 using ""uint8_t"" ***********
Thanks Lorne
Lorne Hinz said:I attached the complete CCS project file yesterday so will not attach it here again.
Yes, but the code there did not even try to do pmap.
Lorne Hinz said:This is the actual code that does not work.
//***************Port Mapping Start ***OPTION #1 using "unsigned char" ***********
const unsigned char port_mapping[] = { // Drive library doc example p 243 uses char instead of uint
// Port P4
PM_NONE, // P4.0
PM_CBOUT1, // P4.1 PM_CBOUT0 or PM_CBOUT1 which ever will work
PM_TB0CLK, // P4.2
PM_NONE, // P4.3
PM_NONE, // P4.4
PM_NONE, // P4.5
PM_NONE, // P4.6
PM_NONE // P4.7
};... ...
I do not know how to use CCS nor driverlib, but what you did does not see right to me. I do not think you satisfied the requirements of the MSP430F5529 chip to do pmap.
I did it my own primitive way, and it works. May be you could try this. Just load the following object code to your F5529 LP with MSP-FLASHER:
@4400 31 40 00 44 3C 40 00 24 3D 40 04 00 B0 13 C2 44 B0 13 50 44 B0 13 D4 44 0F 12 1F 42 00 24 1F 53 82 4F 00 24 3F 90 05 00 04 20 82 43 00 24 D2 E3 02 02 1F 42 02 24 1F 53 82 4F 02 24 3F 90 03 00 05 20 82 43 02 24 F2 E0 80 00 23 02 3F 41 00 13 B2 40 80 5A 5C 01 B0 13 90 44 D2 D3 04 02 F2 D0 80 00 25 02 B2 40 00 04 C2 08 B2 40 63 00 D2 03 B2 40 10 00 C2 03 B2 40 10 00 C0 03 32 D2 03 43 3F 40 99 02 3F 53 FE 2F A2 E3 C2 08 F9 3F 03 43 02 12 32 C2 03 43 B2 40 52 2D C0 01 A2 43 C2 01 F2 40 11 00 E1 01 D2 43 E2 01 B2 40 00 A5 C0 01 E2 D3 25 02 E2 C2 25 02 F2 D0 06 00 2B 02 32 41 10 01 0F 4C 0F 5D 03 3C CC 43 00 00 1C 53 0C 9F FB 23 10 01 80 00 DC 44 FF 3F 03 43 80 00 D8 44 @FFF6 18 44 @FFFE 00 44 q
Scope P4.1 and you will see CBOUT sending a square-wave of ~260 Hz.
Put a jumper between P4.1 and P4.2 and you will see both the Red and the Green LEDs blinking incoherently. This is caused by the TB0CLK with my ISR blinky as shown here:.
#include <msp430f5529.h> #include "obscure.h" volatile int Red, Green; void main( void ) { WDTCTL = WDTPW + WDTHOLD; Hocus_Pocus(); P1DIR |= BIT0; P4DIR |= BIT7; CBCTL1 = CBON; TB0CCR0 = 100-1; TB0CCTL0 = CCIE; TB0CTL = MC_1; __bis_SR_register(GIE); while (1) { __delay_cycles (2000); CBCTL1 ^= CBOUTPOL; } } #pragma vector = TIMER0_B0_VECTOR __interrupt void blinky(void) { if (++Red == 5) { Red = 0; P1OUT ^= BIT0; } if (++Green == 3) { Green = 0; P4OUT ^= BIT7; } }
The pmap is setup by the Hocus_Pocau.
I now have the MSP430F5529 Port Mapping WORKING PERFECTLY
This is Port Mapping Code that WORKS.
Design: MSP430F5529 Launch Pad, CC3100 Wi-Fi, LMT01 Temperature Sensor, and numerous other I/O.
Issue: CC3100 Wi-Fi Booster pack uses Pins1.6 and Pins2.2 thus causing a “Pin Conflict” for the use of P1.6 CBOUT and P2.2 TA2CLK for use in using the LMT01 Temperature Sensor in SYNC Timer Comparator mode.
Goal: Map CBOUT to P4.1, and TBOCLK to P4.2, the only 2 Port 4 Pins on the MSP430F5529 Launch Pad not used by the CC3100 Wi-Fi.
MSP430F55229 Driver Library for “Port Mapping” is WRONG and the Code Example given will not compile without several errors.
Several engineers and software designers could NEVER get the F5529 Port Mapping Driver to work, and replies on this TI site also said that it DOES NOT WORK.
I am happy to share a documented solution THAT DOES WORK PERFECTLY.
Solution: Directly write to the Port Mapping Addresses / Registers (Does NOT use the Port Mapping Driver.)
Engineer…..Lorne
//*******12 Lines of working Code *******
uint16_t *P4LHMAPunlock;
P4LHMAPunlock = (uint16_t *)0x0001C0; //Variable for the Port unlock address, Spec sheet Table 6.15
uint16_t *P4MAPpin0pin1;
P4MAPpin0pin1 = (uint16_t *)0x0001E0; //Variable for the Pin 0 and Pin 1 Mapping address
uint16_t *P4MAPpin2pin3;
P4MAPpin2pin3 = (uint16_t *)0x0001E2; //Variable for the Pin 2 and Pin 3 Mapping address
*P4LHMAPunlock = 0x002D52; //Key to unlock the Port Mapper
*P4MAPpin0pin1 = (*P4MAPpin0pin1 & 0x00FF)|(17<< 8); //Write 17 = CBOUT1 to upper byte for Pin 1; Spec sheet Table 6.7
*P4MAPpin2pin3 = (*P4MAPpin2pin3 & 0xFF00)|1; //Write 1 = TB0CLK to lower byte for Pin 2 Spec sheet Table 6.7
*P4LHMAPunlock = 0x002050; //An invalid key which will lock the Mapper until the next Power On Reset
GPIO_setAsPeripheralModuleFunctionOutputPin (GPIO_PORT_P4, GPIO_PIN1); //P4.1 to CBOUT1
GPIO_setAsPeripheralModuleFunctionInputPin (GPIO_PORT_P4, GPIO_PIN2); //P4.2 to TB0CLK
//***End of ****12 Lines of working Code *******
// F55229 Spec sheet
//Page 57 Table 6.7 Port Mapping Value and (Mnemonic for Dirver but dirver never made to work)
//Page 67: Table 6.15 Address of Port Mapping Control and Port Mapping
//Port Map Control Base Address = 01C0h; offset range 000h-002h
//Port Mapping Port P4 Base Address = 01E0h; offset range 000h-007h
//Page69: Table 6.25 Port Mapping Registers
//I got the exact address by looking at the Registers in CCS and finding the address 0x0001E0 for Ports 0&1, 0x0001E2 for Ports 2&3
// Page 86 6.10.4 Port P4, P4.0 to P4.7, Input/Output With Schmitt Trigger shows P4SEL and PRMAP values to configure each pin
//SLAU397D Port “Generic MSP Port Mapping Controller document – 5 pages
//To enable write access to any of the port mapping controller registers, the correct key must be written into the PMAPKEYID register.
//The PMAPKEYID register always reads 096A5h. Writing the key 0x0002D52 grants write access to all port mapping controller registers.
//It is recommended that the application completes mapping configuration by writing an invalid key at the end to lock the Port Mapper until next PUC Reset
// LH code docuementation
// (*P4MAPpin0pin1 & 0x00FF)|(17<< 8); Read 2 byte word & mask off. Upper bytes are anded with a 0's and lower with a 1's which keeps the lower byte (P4.0)
// OR'd with 17 shift 8 bit to the left to get it to the upper bite for P4.1
// (*P4MAPpin2pin3 & 0xFF00)|1; Read 2 byte word & mask off, Upper bytes are anded with a 1's and lower with a 0's which keeps the upper byte (P4.3)
// OR'd with "1" and not shiffing required as P4.2 is the lower bite, and P4.3 the upper bite is not changed
**Attention** This is a public forum