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.
Hi
I'm using an MSP430f5635 and I want to use the BSL via USB.
I have to made some changes because my XT2 Crytall Frequenzy is on 16 MHz.
So 1. Question : Which source File do I have to use for changing Frequenzies and other device informations (& what other informations do I have to change or to replace )
2. : I want to start the BSL out of an application with the given code out of SLAU319L :
__disable_interrupt();
USBKEYPID = 0x9628; // Unlock USB configuration registers
USBCNF &= ~PUR_EN; // Set PUR pin to hi-Z, logically disconnect from host
USBPWRCTL &= ~VBOFFIE; // Disable VUSBoff interrupt
USBKEYPID = 0x9600; // Lock USB configuration register
__delay_cycles(500000);
((void (*)())0x1000)(); // Call BSL
Do I have to Take care of something else in my main programm or should it work like this?
cheers, Andi
Hi Andi,
Since 16 MHz is not a supported frequency for the USB BSL (24, 12, 8, or 4 MHz are currently allowed) you will have to modify the CUSTOM-BSL430 USB BSL IAR project, the process for doing this is covered in Section 6.1 of SLAA452. BSL entry should work with the example code provided in SLAU319 where the USB stack is already handled, do you have reason to believe that anything else is required?
Regards,
Ryan
Andreas Haas said:I'm using an MSP430f5635 and I want to use the BSL via USB.I have to made some changes because my XT2 Crytall Frequenzy is on 16 MHz.
So 1. Question : Which source File do I have to use for changing Frequenzies and other device informations (& what other informations do I have to change or to replace )
You can do it without rebuilding. Extract BSL binary from your device, find and change USBPLLDIV value from 3 to 2, for 12 MHz. And write it back.
Andreas Haas said:
ok sounds clear but wich given source file do i have to use for changing the clk values.
There is USBPLLDIVB calculation for XT2 inside PI_init() from BSL430_USB_PI.c file, and later calculated value is applayed inside USB_enable() from usb.c file.
As I allready written, for me easyest way will be to modify extracted binary (TI txt file) from original device.
void PI_init() { ... unsigned int timerCCR = TIMER_CCR; // Using local variable to compare register if( timerCCR > (((SPEED_1 + SPEED_2) / 2)/ ACLK_DIV_SPEED) ) { wUSBPLL = *(&cSPEED_1_PLL); // Referencing a constant is done in order to force // the compiler to place the constants in flash // and use them to initialize the PLL. This way // the constants can be modified in the binary image // in order to change the desired crystal frequency. // for instance: all values to 20MHz } else if( timerCCR > (((SPEED_2 + SPEED_3) / 2)/ ACLK_DIV_SPEED) ) { wUSBPLL = *(&cSPEED_2_PLL); } else if( timerCCR > (((SPEED_3 + SPEED_4) / 2)/ ACLK_DIV_SPEED) ) { wUSBPLL = *(&cSPEED_3_PLL); } else { wUSBPLL = *(&cSPEED_4_PLL); } ... USB_enable(); USB_reset(); USBCNF |= PUR_EN; // generate rising edge on DP -> the host enumerates our device as full speed device } } VOID USB_enable() { volatile unsigned int i; volatile unsigned int j = 0; USBKEYPID = 0x9628; // set KEY and PID to 0x9628 -> access to configuration registers enabled USBPLLDIVB = wUSBPLL; // Settings desired frequency USBPLLCTL = UPFDEN + UPLLEN; // Enable PLL, Phase Freq. Discriminator enable //Wait some time till PLL is settled do { USBPLLIR = 0x0000; // make sure no interrupts can occur on PLL-module __delay_cycles(1001); // For lowest code size use a cycle count that is 3*n + 2 // where n is any integer greater than 4 (IAR uses other // instructions when n is less than 5). if (j++ > 1000) return ; }while (USBPLLIR != 0); USBCNF |= USB_EN; // enable USB module }
You can try to enter to BSL mode with pressed / released BSL / PUR button during power-up / reset, with released / free running device. Not by your application under debugging.
I guess that PLL configuration is wrong, but in this case Win should inform you about unknown device.
Let's just back to binary file story that can help also others with the same problem (unsupported XT2 by default BSL).
Here are TI PLL definitions for 4, 8, 12 and 24 MHz XT2, and hex values in combination with default BSL ...
#define UPMB0 (0x0001u) /* USB - PLL feedback divider buffer Bit 0 */
#define UPQB0 (0x0100u) /* USB - PLL prescale divider buffer Bit 0 */
#define USBPLL_SETCLK_24_0 (UPMB0*15 | UPQB0*5) /* USB - PLL Set for 24.0 MHz input clock 050Fh */
#define USBPLL_SETCLK_12_0 (UPMB0*15 | UPQB0*3) /* USB - PLL Set for 12.0 MHz input clock 030Fh */
#define USBPLL_SETCLK_8_0 (UPMB0*17 | UPQB0*2) /* USB - PLL Set for 8.0 MHz input clock 0211h */
#define USBPLL_SETCLK_4_0 (UPMB0*23 | UPQB0*1) /* USB - PLL Set for 4.0 MHz input clock 0117h */
//24MHz will be detected
#define SPEED_1 24000000
#define SPEED_1_PLL USBPLL_SETCLK_24_0;
//12MHz will be detected
#define SPEED_2 12000000
#define SPEED_2_PLL USBPLL_SETCLK_12_0;
//8MHz will be detected
#define SPEED_3 8000000
#define SPEED_3_PLL USBPLL_SETCLK_8_0;
//4MHz will be detected
#define SPEED_4 4000000
#define SPEED_4_PLL USBPLL_SETCLK_4_0;
Easiest way is to find this values inside dumped BSL txt file from original device, replace all this values by requested XT2 PLL, erase and flash with modified BSL txt file.
Your device has this values here...
0x1070: FF FF FF FF 0F 05 0F 03 11 02 17 01 12 01 00 02 | ................
However, original TI USB BSL is close to 2 KByte, but in your file I see some holes (00h) and I am not sure what this dump is (corrupted readout maybe). For example, I attached original factory TI USB BSL for MSP430F5510 and MSP430F5659 with all memory used.
Hi zrno
thanks for your reply :)
I read out the BSL of a new MSP430f5635 and i changed the hex numbers you told me. for 16Mhz it is 11 04.
Then i pulled the PUR pin up while i started the device.
Device manager in windows shows : unknown device, I don't get a VID & PID.
do have any ideas what is still wrong ?
Thank you
regards
Andi
**Attention** This is a public forum