TI E2E Community
Hercules™ Safety Microcontrollers
Hercules™ Safety Microcontrollers Forum
UART implementation using HET Timer. Trying to achieve 208us using HET
I am trying to implement UART using HET timer. Required baud rate is 2400 (i.e. 416us/bit). During receive I am receiving an falling edge interrupt from GPIO. When I receive this interrupt, i need to start HET timer and get an interrupt at 208us. Have difficulty achieving this.
Is there a minimum time to get an interrupt using HET timer?
Do you have any sample code that you can share?
My sysclock = 7.2738 MHz and iclk=3.686 MHz
Thanks for using our forum.
Which device are you using?
If my reply answers your question please click on the green button "Verify Answer".
Using this device with 7.3728 MHz oscillator, sysclock = 7.3728 MHz and iclk=3.6869 MHz
Please let me know ur suggestions.
One option is to use a CNT instruction in your HET code. This instruction can generate an interrupt on overflow.You have to set the MAX count value (25bits) that will match your 208us interrupt requirement.CNT Instruction counts HET Loop Resolution.
Are you using your HET for something else? If yes can you provide the definition of LR and HR so I can make the math for you?
Attached are the HET files and main application file with sysclock=7.3728MHz.
Code in main file uses HET to get timing for 2400 baudrate serial communication. 1bit length = 416us and 1/2 bit lenght =208us. Data is received and sent using GPIO and not HET pins.
So, during transmit, ucontroller starts HET to interrupt at 416us. and clocks out a bit on GIOA every HET interrupt. Command sent out is a 1byte with 1start bit, 1 parity bit and 1stop bit.
During receive, on receiving a falling edge interrupt, HET is initialized for 1/2 bit length (208us) and when the HET interrupt occurs, input bit is read from GIOA. After reading the GIOA, HET is initialized for 1bit length (416us). When HET interrupt occurs, input bit is read from GIOA. After reading HET is initialized for 1bit length (416us). This process repeats untill the complete response is read -- response is a total of 22 bits.
startbit - 8bitdata - paritybit - stopbit - stopbit - startbit - 8bitdata - partitybit - stopbit
I am having difficulty achieving 208us with HET. Please review and let me know ur findings.
I don't see any attachment.
Can you resend?
I'm working on your question.I have to reproduce your environment to be able to understand the problem.Without the full project, I have to re-write some test code. Will it be possible to share the full project?I can provide my email address if you don't want the code to be public.(I'm not familiar with the specific HET code, I did not write it)
If you find a solution to your problem, please let me know.
Sure,Please send me ur email so I can send you the project in zip.
I've send you a "friend request" via the forum. Once you accept it we should be able to exchange emails.
What is the status on your post? Did I answered your question?If so, can you mark it as "Verified Answer" so I can close this thread?
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.