![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| I am using a pic18f4550 to transmit data over a wi.232 wireless module from Radiotronix. I have successfully been able to send data but it seems that the later revisions of the pic18f4550 chip do not work correctly with the module. My problem is that when using the latest A5 revisions of the chips characters sent over the module are not received correctly. Sending a '#' results in a 'n' on the receiving end. Earlier revision chips do not experience this issue. However when putting the chips in loopback mode the transmission is fine and characters are read in correctly. The modules are cmos compatible so I do not think the levels are the problem. Im running at 9600baud, here is my code which does work: // configure USART OpenUSART( USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 77 ); //48000000/(64 * 9600)) -1 = 48000000/614400 = 78 - 1 = 77 //77 = 9600bps baudUSART( BAUD_IDLE_CLK_HIGH & BAUD_8_BIT_RATE & BAUD_WAKEUP_OFF & BAUD_AUTO_OFF ); The newer chips do not have any errata docs associated with them. Does anyone have any ideas what my problem could be? Microchip and Radiotronix are not helping me because the chip passes a loopback and the modules work correctly by themselves. | |
| |
| | (permalink) |
| Sounds like a baud rate mismatch, perhaps a timeing issue or clock rate difference on the older chip. Send a solid constant stream of "U" 's This will give you a 'clock' on the UART out line that will allow you to determine the actual baud rate it's transmitting at. You can view this on a scope or logic analyzer. Something is definitly affecting the clock rate, or the same data would be transimited.
__________________ "Because I be what I be. I would tell you what you want to know if I could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." | |
| |
| | (permalink) |
| I had a problem very similar to this recently. I had a 16F887 with an internal oscillator that ran at 5.3MHz when 8MHz was selected. I wasted a few hours on that problem as I only ever think that hardware is wrong as a last resort. Had I put the above chip in loopback then it would have worked perfectly. Mike. | |
| |
| | (permalink) |
| Sceadwian, The funny thing is I tried transmitting the 'U' as you suggested and it works fine! I will be able to put this on a scope tonight but I am not really sure what to look for. Do I need some type of interface logic to bump the 5v to 3.3v that the wi.232 module is running on? Last edited by HakBot; 3rd October 2007 at 09:56 PM. | |
| |
| | (permalink) | |
| Quote:
Because U is 01010101 ![]()
__________________ Superman returns.. | ||
| |
| | (permalink) |
| Are you running on the internal oscillator? Internal osc can be difficult to get the required accuracy. Also in some parts it will start on internal osc and if the primary oscillator won't start properly then it will keep running the internal osc. Are you trying to SLEEP between reception? This causes problems with the UART, if the clock oscillator turns off then there's no clock source for the baud clock and it takes too long to start up the osc too to correctly receive at least the first character.
__________________ I thought what I'd do was I'd pretend I was one of those deaf-mutes. | |
| |
| | (permalink) |
| If you are using the internal OSC then theres your problem right there. That and keep in mind that it is good practice to throw a 0.1uF and 1uF on the supply to filter spikes and sudden load changes. I have found in the past that the 0.1uF Tantalum Cap helps improve stability and accuracy by a fair amount
__________________ Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net | |
| |
| | (permalink) |
| The internal OSC is far to inaccurate to be used with highish speed UART
__________________ Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net | |
| |
| | (permalink) |
| Im using an external 20MHz crystal. With my config bits set (http://i140.photobucket.com/albums/r29/HakBot/cap.jpg) this gives me a 48MHz fosc. I only experience these issues though with the A5 die chips though. Placing an A3 in my circuit yields great results. Last night I hooked up a TTL->RS232 shifter and I get the same results as the wireless module so this tells me it is really not the module. Radiotronix also stated that nothing is needed in between the mcu's Tx output and the Wi.232 input. | |
| |
| | (permalink) |
| Try disabling PLL and reconfigure the program to run @ 20Mhz. PLL has also been known to introduce problems with timing sensitive applications such as UART
__________________ Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net | |
| |
| | (permalink) |
| gramo, I disabled PLL. Results from that are the same. | |
| |
| | (permalink) |
| hi HakBot, Have you tried a 'direct' cable link from the PIC UART and a PC? ie; without the wi module. This should eliminate/confirm timing problems. hi gramo, Long time no see.
__________________ Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ | |
| |
| | (permalink) |
| eric, Yes, but I had a ttl shifter in there. The results are the same as the wi module. IE: sending a '#' will result in an 'n' and other unexpected chars. Sending a 'U' again works fine. | |
| |
| | (permalink) |
| I previously thought that there was no pattern to the characters received on the terminal but Ive checked into this further and there does seem to be a pattern. It seems that most of the characters are off by 4 and inverted? sent from A5 silicon chip read in terminal putcUSART(1); //xFD putcUSART(2); //xF6 putcUSART(3); //xF2 putcUSART(4); //xEE putcUSART(5); //xEA putcUSART(6); //xE6 putcUSART(7); //xE2 putcUSART(8); //xDE putcUSART(9); //xDA putcUSART(10); //xD6 putcUSART(11); //xD2 putcUSART(12); //xCE putcUSART(13); //xCA putcUSART(14); //xC6 putcUSART(15); //xC2 putcUSART(16); //xBE putcUSART(17); //xBA putcUSART(18); //xB6 putcUSART(19); //xB2 putcUSART(20); //xAE putcUSART(21); //xD5 putcUSART(22); //xA6 putcUSART(23); //xA2 putcUSART(24); //x9E putcUSART(25); //x9A putcUSART(26); //x96 putcUSART(27); //x92 putcUSART(28); //x8E putcUSART(29); //x8A putcUSART(30); //x86 | |
| |
| | (permalink) | |
| Quote:
Back on topic I'm out of idea's I'm afraid. Perhaps the chip has been internally damaged via static... My last couple of thoughts would be; - Are all Vdd and Vcc pins (2 of each) connected to their respective supplies? - Do you have the 0.1uF tantalum capacitor mounted as close as possible between a Vdd and Vcc on the PIC? - Is your Crystal correctly loaded (what value caps are you using with your crystal?)
__________________ Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net | ||
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| Pic 18452 Usart | the dude of dudes | Micro Controllers | 5 | 14th July 2006 03:52 AM |
| 16F628A USART - Sync receive mode | kenmac | Micro Controllers | 14 | 6th June 2006 10:16 PM |
| DIGITAL CLOCK HARDWARE DESIGN (PLS CORRECT) | Jay Duluguin | Electronic Projects Design/Ideas/Reviews | 4 | 18th February 2004 05:33 PM |
| Please help: Receiving RS232 command and output a feedback | edmondli | Micro Controllers | 1 | 5th January 2004 07:34 AM |
| Usart to Usart? | Eclipsed | General Electronics Chat | 7 | 23rd October 2003 05:07 PM |