Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write flash good, write configs fail [solved]
#1
Hi dear Mikael, hi dear all!

I have the next problem:

When I loading my program to the hardware, the flash write is always good, but the end of write config words is always fail.

I get the next message in debug mode:
...
Write flash succeded
...
Writing config word 3 byte 0 (0x007B)...ok
Writing config word 3 byte 1 (0x00FF)...ok
Writing config word 4 byte 0 (0x00BE)...ok
Writing config word 4 byte 1 (0x00FF)...The hardware detected a framing error.unknown response 0xAA, 1 try
Write configs failed

Closing port
Tx 18,7kB / Rx 120 bytes / 6,8s
Write failed

After that, my program is running almost perfectly, but the UART can not receive. (More precisely, the UART can receive very rarely)
If I put a line into my code, and I send a 0x55 periodically from the main loop, the Baud rate is 38400 bps. As accurate, as an atomic clock.

I watched the signal forms with oscilloscope, Rx, Tx were totally good;

Loader version: 1.4.6
firmware version: 4.0.0 March 2011
uC: dsPIC33FJ32GP302
FCY in loader: 5,5295 Mc (11,059Mc Xtal with te original loader configs)
FCY in my program: 22,118Mc (11,059Mc Xtal with PLL)
Baud rate: 38400 bps
I do not use Tx enable signal
The faulty last response 0xFE at 9600 bps, 0x54 at 57600 bps, and 0xE0 at 115200 bps

I have to use different config settings in the loader, and in my program,
because I need Fosc=44,236 Mc / FCY=22,118 Mc.
If I would use the same settings in the loader, the VCO frequency would be 276,475 Mc because of the default settings of PLL registers.
I don't want to differ so hard from the datasheet. (enabled max. VCO freq.: 200 Mc)

... Ooops! Maybe, I would to set on the PLL registers from the ds30loader.s ... ?

Thanks for any idea in advance!
Gyuri
Reply
#2
Hi,
Config 4 contains the vital FOSC setting. It might not be possible to write that run-time. I'm not sure. I think you will have to ask Microchip about it. In the meantime you can try to remove config 4 from the hex file.

Either way it is highly recommended to not write configs unless you really really need to. Do you have a good reason?

If you need you can add your own initialization in ds30loader.s:
Code:
;------------------------------------------------------------------------------
; User specific entry code go here, see also user exit code section at end of file
;------------------------------------------------------------------------------

Mikael
Reply
#3
Hi dear Mikael !

Thanks for Your advice! The problem has been solved.
I put my complete config settings to the settings.inc,
and the PLL settings (CLKDIV and PLLFBD) to the ds30loader.s .

Now I am writing only the program, without the config words.
And I had to disable the UART before reconfiguring it, as You mentioned in another thread. / Without disabling the receiving was faulty./

Gyuri
Reply
#4
Great! Thanks for the feedback.

Mikael
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)