CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

[SOLVED] internal oscillator with PIC18F45K80
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 2:59 am     Reply with quote

Rubbish at the beginning of reception, is _not_ a sign of a baud rate error.

It's almost certainly a sign that the charge pump in the RS232 generator (assuming you are using such a chip), has not fully stabilised.

You are looking at the wrong thing for the problem.
silelis



Joined: 12 Jun 2007
Posts: 68
Location: Poland, podlaskie district

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 3:46 am     Reply with quote

So what is the solution? I can not change a lot in hardware of device. This au78690 is some kind of enhanced 8051
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 5:14 am     Reply with quote

Mr T is 100% correct, to get perfect baud rate, you need an external crystal that is 'binary' in value. 2.457600MHz is another example. When you /2 you'll get 100% baudrate.

There are some things you can do though.

1) Once the PIC is 'setup', execute a delay_ms(500). This should be enough time for the MAX232 device to 'charge up'. If you have an LCD module you need to do this before the lcd_init() function . This way the hardware is allowed time to configure itself.

2) 'Flush' (clear) the UART buffers. The UART may contain 'garbage' data in it's hardware buffer, so it should be read and discarded. As well, the software buffer also needs to be cleared (zeroed) of all data BEFORE main() is run. CCS supplies the directive #ZERO_RAM which fills ALL RAM with zeros however it's probably better to cut your own code to just 'zero' your 'UART received data buffer.

3) Your other device, the au78690 may not be running at 57600, unless it has an external xtal. Generally speaking, serial communications with UARTs must have their baudrates within 3% TOTAL. It is common different 'devices' to be 'slightly' off of the BAUDRATE speed. One quick test is to have the device send a continuous stream of 'U' and look with an oscilloscope to see the data. each bit should be 1/10th of the baudrate. Hmm, pretty sure it's a capital U, ASCII chart will confirm this. Some UARTs need better than 2% to 'lock' onto the data and that's why for 100% accurate data over long periods of time, you need binary xtals.

4) Also, be sure you have a good ground between devices, stable power supplies, etc.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 7:01 am     Reply with quote

and one thing, make sure you have PUT in the fuses.

This is there to delay the PIC starting, until it's own oscillator has had time to stabilise.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 10:16 am     Reply with quote

hmm.. I googled 'au78690' and didn't get one hit about any enhanced 8051 device. Can you supply a good link to whatever it is please?

Jay
silelis



Joined: 12 Jun 2007
Posts: 68
Location: Poland, podlaskie district

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 10:39 am     Reply with quote

There is a huge problem with datasheet to this chip. Only basic data please look at it.

It is:
Quote:

A highly integrated SOC for MP3/WMA player, AU7860C integrates MCU,
MP3/WMA decoder, OTG, SD/MMC card controller, SARADC, Audio DAC, RTC,
LCD driver and an IR decoder in a single chip. Compared with traditional flash- MP3
player, AU7860C offers low cost, low power consumption, flexible and more powerful
host MP3/WMA player solution.

1.1 Features
l Enhanced 8051, up to 10 times faster than standard 8051
l OTG 2.0 full-speed controller
l SD/MMC card controller
l Support MP3 decode
l Support WMA decode
l Embedded sound equalizer
l Support tag format ID3v1 and ID3v2.4
l Support FAT16/FAT32 file system
l Embedded 18-bit Audio DAC
l Support auxiliary audio input
l Support FM audio input
l Support multiple channel SARADC for peripheral controls
l Embedded segment LCD driver
l Embedded RTC
l Support IR Remote control
l GPIO for various purposes
l Embedded LDO
l Embedded Power-on-Reset
l Embedded 64KB OTP for program code storage
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 10:58 am     Reply with quote

OK, 1st concern

Are you running the PIC and the au device on 3 volts ?

The device is a 3 volt unit so you need to run the PIC at 3 volts( check speed though) or use logic level conversions between them.

Jay
silelis



Joined: 12 Jun 2007
Posts: 68
Location: Poland, podlaskie district

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 11:38 am     Reply with quote

The au7860 mp3 players have resistor (1k) on UART lines to prevent port burning (also place to solder resistor devider - the designer do not do this) but I am considering to use BSS138 LLC and solder out 1k resistor. Also I have spoken with designer and he told me that on PIC rx au TX line I can solder smaller (500 om) resistor.

Also I am considering to try with BSS138 LLC.


Last edited by silelis on Mon Oct 09, 2017 11:41 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 11:40 am     Reply with quote

Yes. The Voh of the unit only gives 3v, so needs a buffer chip to work with a 5v PIC.
silelis



Joined: 12 Jun 2007
Posts: 68
Location: Poland, podlaskie district

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 11:42 am     Reply with quote

Ttelmah wrote:
Yes. The Voh of the unit only gives 3v, so needs a buffer chip to work with a 5v PIC.


What do You mean by "buffer chip" LLC or what?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 11:55 am     Reply with quote

First, lets repeat an old adage. No matter how good a chip may look, if proper data is not available, forget it.

The 'mvsilicon' site does not have a current Chinese ICP license, so is almost inaccessible outside China. Not an encouraging start. However there are partial copies of some of the sheets outside, and a better (later) version of the sheet you show.

This shows that the I/O voltage of the chip outputs go to 3v maximum. So need a logic buffer to drive a PIC input. Almost any TTL input non-inverting buffer. Something like a 74HC365.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 2:29 pm     Reply with quote

If the project is to build an MP3 player, it's super easy to take a $3 MP3 player and add a $2 PIC to be the 'controller'.
newguy



Joined: 24 Jun 2004
Posts: 1899

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 6:12 pm     Reply with quote

temtronic wrote:
If the project is to build an MP3 player, it's super easy to take a $3 MP3 player and add a $2 PIC to be the 'controller'.


Sort of like carving a wooden spoon. ...From a larger spoon.

Laughing
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Oct 09, 2017 11:20 pm     Reply with quote

There are much better documented chip-sets available.
Without the LCD, the AT83SND2CMP3, but this is relatively expensive.
For a cheap chip, the YX5200-24SS, is used on a couple of modules, but the documentation is all Chinese. It is however a lot more complete than the data for the current chip, and there are Arduino libraries for this which make software easy to write.
In all cases though, these are 3.3v chips, so much easier to drive with a 3.3v PIC.
silelis



Joined: 12 Jun 2007
Posts: 68
Location: Poland, podlaskie district

View user's profile Send private message

PostPosted: Tue Oct 10, 2017 12:02 am     Reply with quote

I agree that documentation is poor but the chip is cheap :D and had USB and USB-OTG support not only SD (which is to me the most important) as well as mp3 - wma (wma as a addition).

I am soldering BSS138 LLC and back with my feedback in time I know more.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group