RetroBSD

2.11BSD operating system for microcontrollers
It is currently Sun Mar 29, 2020 9:44 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Thu Dec 17, 2015 3:46 pm 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Hi,

How do I set the clock source parameters when building the kernel? I seem to have messed up the flash on my HMZ144 board and I now get trashed console output on boot. Every baud rate I set just returns garbage and I think my boards crystal may not be starting reliably any more so I'm thinking of changing it.

One other question, do I need to re burn a boot loader into the HMZ144 or can I just use my pickit 2 and pic32prog to burn the new kernel?

Any pointers?

Thanks all,

Dan


Top
 Profile  
 
PostPosted: Thu Dec 17, 2015 5:42 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
The LiteBSD Guide is here:

viewtopic.php?f=14&t=37103

The clocks are set within the bootloader you must have flashed in.
Do not flash the kernel, however.. Do upload the kernel via UART (Tx/Rx/Gnd, 115k2, 8N1) w/ pic32prog instead.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Fri Dec 18, 2015 8:30 am 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Hi Pito,

Thanks for the reply, that's what I thought. Do I use the bootloader attached to your first post on installing LiteBSD? I'm fairly sure I tried that and it wouldn't upload but I'll give it another go.

Thanks again,

Dan


Top
 Profile  
 
PostPosted: Fri Dec 18, 2015 8:40 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Yes.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Mon Dec 21, 2015 8:16 am 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Hi Pito,

That bootloader doesn't work for the Olimex HMZ144, the clock settings are all wrong as it has a 12MHz crystal. I did managed to reflash the board using my pickit 2 and the build I produced so all wasn't lost.

I'm also finding that the HMZ144 is very sensitive to psu noise and gives out rubbish chars on the serial whilst trying to boot. I think the crystal on this board is susceptible to the noise and hence the boot and serial issues. I think I'm going to have to bolt on a proper oscillator rather than use the on board crystal.

Thanks again,

Dan


Top
 Profile  
 
PostPosted: Mon Dec 21, 2015 1:50 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Sorry, I've forgotten the olimex uses a different xtal value :(
There is an errata for the pic32mz related to the local Xtal oscillator - look at the thread we've discussed already..
viewtopic.php?f=14&t=37077&p=42357&hilit=oscillator+pic32mz#p42357

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Mon Dec 21, 2015 2:31 pm 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Hi Pito,

I think I'll swap the crystal out for the same one as everyone else uses. It'd be a quicker job and a lot tidier! Plus it'll be more reliable I'm thinking.

You don't happen to know where the crystal frequency is defined do you? I've only had a quick scout around but can't seem to find it...

Thanks,

Dan


Top
 Profile  
 
PostPosted: Mon Dec 21, 2015 2:41 pm 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Oops, didn't look hard enough or didn't see it first time around, just found it in machdep.c in sys/mips/pic32 source folder!

Thanks any way, Dan


Top
 Profile  
 
PostPosted: Mon Dec 21, 2015 3:15 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
There is an another of my naïve postings :) - baremetal LiteBSD, where I am looking for a baremetal configuration, retrobsd-like one, where you can setup the clock directly within the configuration for "baremetal" (it means all the clock dividers and pll multipliers are exposed for editing) and flash the kernel via pic32prog and pickitX.
I like it much as I can mess with clocks to my liking.. :lol:

Not sure the machdep.c is the right place for the clock changes, though (the clocks are set inside the bootloader, afaik).

Quote:
I think I'll swap the crystal out for the same one as everyone else uses.

Did you try with the 10k resistor (see errata - a pull-up resistor is required on OSC2 - it helps oscillator to start)??

Quote:
I'm also finding that the HMZ144 is very sensitive to psu noise and gives out rubbish chars on the serial whilst trying to boot. I think the crystal on this board is susceptible to the noise and hence the boot and serial issues.

A suboptimal design (like the atmega1284p problem when oscillator set to low power) where the osc input pin is adjacent to ie. an Uart pin may produce weird behavior. With atmega it helped to increase the "voltage swing" of the oscillator to make it less susceptible to by the Uart pin induced crosstalk.
I would guess increasing the power/amplitude of the oscillator may help pic32mz too. That could be achieved by the above 10k resistor (osc2 is the output of the osc) and/or a resistor in parallel with crystal (something like 100k), I guess.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Tue Dec 22, 2015 11:09 am 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Hi Pito,

I can't flash my HMZ144 as the bootloader doesn't work with it hence I've been directly flashing the processor with a pickit 2 which seems to work for me. The board I have also has the 10k pullup mod on the oscillator but it still seems erratic at starting up hence my idea to change the clock source.

I'll have a go at placing a 100K resistor in parallel with the crystal first though and also try a 240ohm in series if that fails. The clock source does seem to be the culprit though and the signal is very low on my digital storage scope.

One other thing it could be is that the serial usb adapter is connected to a laptop and they are notorious for injecting noise on the ground connections. Unfortunately my workstation is out of action behind the Christmas tree so I can't verify that as a cause yet :)

Thanks for all the pointers though, much appreciated!

Dan


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission