Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dsPic33FJ128GP802 => not working...

I have read all the threads here but havent found an answer wether this bootloader works without a external crystal, since im not working with one.

Im using the mplab ide and programmer pickit2.

I have a usb-to-rs232converter module from pololu.
When usbmodule tx and rx pins are connected to dspic rx and tx pins the uart therminal (in your gui) prompts "?" chars in the receive box even though i send something else (for e.g. "heips") in my case...
Isn't it so that the chars sent from terminal should be "looped" back to receive field in order to get the bootloader to work properly ?

when i connect the usbmodule VDD and GND to dspic. I get no response in the terminal.

I have configured RB1 <=> RP1 as U1RX and RB0 as U1TX
The problem is as i think in the oscillator setups (maybe) so first of all. Do i need an external crystal to get this workin, if not, what could be the best way to get the bootloader work with 40MIPS, since my end product will use 40MIPS speeds.

I know that the attachment file configs are not set properly to work with 40MIPS but i have tried this : (i suspect the hex value of 0x0744 may be wrong...)
mov.w W0,0x0744

clr W0
mov.w W0, CLKDIV
mov.w #41, W0
mov W0, PLLFBD
.equiv     FCY,                 40000000

but it didn't work.

How is the terminal thing actually working ?
am i able to transmit and receive strings/chars any time when the power is turned on or is it only in the 3 second time window when power is set?

I don't know the firmware of the code. But the gui version is
1.5.5 (engine 2.2.8 )

Attached Files
.zip   firmware (Size: 118.22 KB / Downloads: 14)
Still waiting for expertice help on this one.
I suggest that you try the internal oscillator without PLL first.
I have tried, or i think i have tried... Maybe i'll have to try it again.
I'll post the result later on.

Is this the correct way of doing a loop in the bootloader ASM code, and where should i put this code if this ?
bset    PORTB, #PORTB2        ;
bclr    PORTB, #PORTB2        ;
; Ok here i have to do some command to jump back to loop: "start" but what is the command ? is it => je loop: or maybe as in basic => goto loop: ?
You can use the bra instruction to branch to loop:
bra loop
Ok so now i have FCY set to the 3.685. The FRC is selected and RB2 pin is turned on/off in a loop.
With my scope i get a frequency of 921-925KHz that seems to me to be near 1/8th (7.37/8 ~ 921KHz )of the internal reference frequency !?

When i played around with the pll, i got frequencies of 6.63Mhz and something like 9.94MHz if i recall correctly when FCY was what ever, it seemed not to affect the frequency.

I tried also the PLL lock wait loop, but sometimes it was stuck in the loop i.e. no frequency was detected on RB2 or then the weir frequencies were there.

Any good hints how and what i may be do wrong now ?

And one clarification, i'm measuring the frequency as the periodtime from pulse start to next pulse start.
If i measure just the peak of the pulse, its approximately 3.6MHz
So as a recap, does the 40Mips on dspic specs mean that the min pulse width generated from a pin may be 40Mhz long or is it the period time from pulse start to next pulse start ?

Attached Files
.zip   firmware 16-bit (2).zip (Size: 118.36 KB / Downloads: 10)
If the measured frequency is 921kHz, fcy=3685000 is correct.
Have you configured PPS correctly?
(2012-11-25, 18:57:59)Mikael Gustavsson Wrote: If the measured frequency is 921kHz, fcy=3685000 is correct.
Have you configured PPS correctly?

hmm. What do you mean by configuring PPS correctly if i use PORTB => RB2 default pins as outputs ?
Isn't PPS = "Peripheral Pin Select" and is used only to map special features to a specific pin, for e.g. UART2 module to RP2 pin (would be the same pin as RB2). For now i only have tried to get the Oscillator configured correctly without PLL. I haven't tried yet further with UART pin mappings...

About the frequency, i saw this in the data sheet.

DOZE<2:0>: Processor Clock Reduction Select bits
111 = FCY/128
110 = FCY/64
101 = FCY/32
100 = FCY/16
011 = FCY/8 (default)
010 = FCY/4
001 = FCY/2
000 = FCY/1

Well, 3685000/8 is approx. 460KHz... but DOZE is maybe not enabled so i think this is not the thing in my case...

Then i saw this:

bit 7-6 PLLPOST<1:0>: PLL VCO Output Divider Select bits (also denoted as ‘N2’, PLL postscaler)
11 = Output/8
10 = Reserved
01 = Output/4 (default) => I ASSUME output means Fosc frequency (7.37Mhz)
00 = Output/2

Where am i actually setting these 2 bits in your code. If these bits equals 1 in decimal value, then the output would be 7.37MHz/4 which again is near 2Mhz, so why do you say that the measured 921KHz is correct with FCY value of 3685000, what is the equation for this result ?
You need to account for two clock cycles for each instruction. 2MHz = 1MIPS for most dsPIC33F devices.

Forum Jump:

Users browsing this thread: 1 Guest(s)