8-bit Microcontrollers Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

8-bit Microcontrollers Knowledge Base

Labels

Discussions

Sort by:
Here are the latest version source codes for AN4440. And migration of MC9S08PT60.   Boot_Loader.zip  --- GUI running on PC. IDE is Visual C# 2008 Express, can be imported to Visual C# 2010 Express. AC32_Bootloader.zip  ---  The project combined AC32 bootloader with user code. IDE is CW6.3 PT60_Bootloader 20130307  --- The project combined PT60 bootloader with user code. IDE is CW10.6.   You can get the Visual C# 2010 Express all in one ISO here: http://go.microsoft.com/?linkid=9709969   visual-studio-express-vs may also work, but I haven’t tried it yet. https://www.visualstudio.com/en-US/products/visual-studio-express-vs
View full article
/**********************************************************************************************************************************/ Services performed by FREESCALE in this matter are performed AS IS and without any warranty. CUSTOMER retains the final decision relative to the total design and functionality of the end product. FREESCALE neither guarantees nor will be held liable by CUSTOMER for the success of this project. FREESCALE disclaims all warranties, express, implied or statutory including, but not limited to, implied warranty of merchantability or fitness for a particular purpose on any hardware, software ore advise supplied to the project by FREESCALE, and or any product resulting from FREESCALE services. In no event shall FREESCALE be liable for incidental or consequential damages arising out of this agreement. CUSTOMER agrees to hold FREESCALE harmless against any and all claims demands or actions by anyone on account of any damage,or injury, whether commercial, contractual, or tortuous, rising directly or indirectly as a result of the advise or assistance supplied CUSTOMER in connection with product, services or goods supplied under this Agreement. /**********************************************************************************************************************************/   Hello all.   I would like to share a couple of example projects for some S08 devices for EEPROM emulation on the regular Flash memory. Some of the projects are for CodeWarrior v6.3 (Classic), and others are for CodeWarrior v10.x (Eclipse). The attached document TN228 explains how to run part of the code in RAM, as devices with single Flash array must run from RAM when erasing or programming, so, you could use it as reference.   Application Note AN3822 explains the implementation on Dual Flash array devices; this document is available at the following link: www.freescale.com/files/microcontrollers/doc/app_note/AN3822.pdf   Hope this will be useful for you. Best regards! /Carlos
View full article
1 Introduction.   This document provides tips and tricks for implementing a Software Reset by writing to the SRS register of some MC9S08 MCUs.     2 Detailed Description.   Watchdog module (Computer Operating Properly: COP) provides a secure method of ensure that the microcontroller is properly executing the programmed code, because it provides a specific time window before requiring clearing the timer; if a code-runaway condition or blocking code situations happens, the watchdog won’t be cleared, and a Reset will occur.   This characteristic could be also used as software reset implementation. There are many versions of the COP module, and each of them has its own SRS configuration register and clearing mechanism. Below you can find two variations of the SRS register description:   “Writing any value to SRS address clears the Watchdog timer”: It is included in devices like the S08AW60, S08JM60, and S08QE32. Figure 1 shows the register description of S08JM60 device:   Figure 1: SRS register on S08JM60 device.   “Writing 0x55 -> 0xAA sequence to SRS address clears the Watchdog timer”: It is included in devices like the S08DZ128, S08MM128 and S08SG8. Figure 2 shows the register description of S08SG8 device:     Figure 2: SRS register on S08SG8 device.   Taking as reference the second case, it is possible to generate a Software Reset by writing a value different than 0x55 or 0xAA, to SRS register. It is based on the following sentence, included on the Watchdog description section of device’s Datasheet/Reference Manual:    “The COP counter is reset by writing 0x0055 and 0x00AA (in this order) to the address of SRS during the selected timeout period. Writes do not affect the data in the read-only SRS. As soon as the write sequence is done, the COP timeout period is restarted. If the program fails to do this during the time-out period, the MCU will reset. Also, if any value other than 0x0055 or 0x00AA is written to SRS, the MCU is immediately reset.”   However, there are some conditions that could cause that the reset is not such immediate. If the COP is cleared (writing 0x55 and then 0xAA) and the 1 KHz clock is being used as COP clock, there is a window of 1 or 2 clock cycles after the timer clear when the circuitry is resetting the counter.  If a write of bad data is done right after the timer clear within such 1-2 clock window (1-2 ms) the COP will not be reset until the next write (of any value).     3 Solutions.   It is more common that this issue happens in periodic tasks.  So, in order to fix it, the following workarounds could be implemented:    Execute the bad write before clearing the COP. A useful test could be running a main loop and enabling a push button; if button is pressed, application writes a bad value to SRS register. This is asynchronous to the periodic task and would resultin a reset “immediately”. Change to Bus clock for COP clock and change COPT bits to 11 for the longest time out (which is longer than 12.5 ms periodic task to clear). Then, the window after the timer clear is only 2 Bus cycles (that aren’t enough to execute the write instructions) and any subsequent bad write is seen as a bad write and the reset happens “immediately”.
View full article
This example application based on Processor Expert runs on a TWR-S08RN60 board and implements Touch Sensing electrodes for controlling the enable, speed and direction of a DC motor. The touch electrodes are controlled using the Touch Sensing Software v3.1, included on PEx:     TOUCH_PAD0 reduces the speed of the motor. TOUCH_PAD1 increases the speed of the motor. TOUCH_PAD2 changes the motor direction. TOUCH_PAD3 enables/disables the motor movement.     The motor direction is controlled by two GPIOs connected to an H-bridge mounted on a TWR-PROTO, and the speed is controlled by PWM channel 0 of FlexTimer 1. Besides, the RN60 is controlling eight multiplexed 7-segments displays to indicate the percentage of speed. The frontplanes and backplanes are implemented with GPIOs, and the time base for the multiplexing is provided by the MTIM0 module.     The code was generated and compiled on CodeWarrior for Microcontrollers v10.6 and Processor Expert 10.3 for the Freescale HCS08 series of microcontrollers.
View full article
The purpose of this document is to demonstrate the importance about trimming a microcontroller unit (MCU) showing the differences between an untrimmed and a trimmed device.
View full article
This example application implements Touch Sensing electrodes for controlling the enable, speed and direction of a DC motor. The RN60 is also controlling eight multiplexed 7-segments displays to indicate the percentage of speed. The code was generated and compiled on CodeWarrior for Microcontrollers v10.6 and Processor Expert 10.3 for the Freescale HCS08 series of microcontrollers.
View full article
A stepper motor is a small brushless synchronous electric motor that can divide a full rotation into a large number of steps. If it is electronically connected to the MCU, the motor's position can be controlled with precision without any feedback mechanism.   The purpose of this example is to demonstrate how to control a Stepper Motor using the TWR-S08PT60 , including modules as TSI.   The touch sensing electrodes control the stepper motor, its direction, step type and stop.       In order to get more information about the Stepper Motor, please refer to the following documentation: Quick Start for beginners to drive a Stepper Motor   The code was generated and compiled on CodeWarrior for Microcontrollers v10.6 and Processor Expert 10.3 for the Freescale HCS08 series of microcontrollers.   Please be aware that the motor is connected to the microcontroller through a current driver.  
View full article
How to allocate HC08 library of boot loader application .
View full article
最近在支持几个PT60的家电项目,遇到一个共同的问题,就是程序运行的时候,显示数码管会有不规律的闪烁。 几个项目都是以触摸TSI为核心的,对方工程师反应,如果把TSI的中断关闭就不会有闪烁现象。数码管的扫描程序是在MTIM的中断中完成的,经初步分析推测,应该中断时序错乱导致的问题。 因此我们想着这个应该用中断嵌套的方式可以解决。 中断嵌套的定义简单来说,就是当MCU正在处理一个低优先级的中断的时候,来了一个高优先级的中断,系统此时就会放下低优先级转向去执行高优先级的,完了之后继续回来执行低优先级的。 按照这个逻辑,我们应该只要将各个中断的优先级预先设好就没有问题了。项目一共用了四个中断TSI,RTC(这两个中断组合完成TSI扫描按键,是基于sam之前写的的算法),MTIM(数码管扫描),KBI(用作低功耗唤醒)。 因此,我们把MTIM的优先级设成最高,就应该不会再出现闪烁的现象了,但改完之后,结果依旧失败。   经过不断讨论以及查找数据手册,最终实现了,但不得不说PT60实现中断嵌套还是挺麻烦的。 我们一步一步来:   1.首先我们来看CPU是执行中断的顺序。其余步骤没有什么特别,关键就在于第2步。 2.我们来看这个I位的作用。当进入某个中断之后,这个I位就会被自动置位,也就是系统将整个interrupts都给关掉了,这么做的原因也就是为了让系统在执行某个中断的时候,不会被其他的中断给干扰打断。 那么这就是为什么我们会中断嵌套失败的根本原因! 3.因此,如果我们需要使用中断嵌套的话,那么就需要在每个中断程序里面添加这个清楚CCR寄存器I位的指令,asm cli。 4.因为中断嵌套被启用了,有潜在的风险会导致进中断前一些堆栈数据出错或者中断优先级出问题等,那么在中断程序的最后,我们再加一句话,让一切恢复正常就可以了 IPC_SC_PULIPM = 1;   经过以上步骤,中断嵌套就能够实现了。     但在这个过程中,遇到了几个问题,也和大家分享下 1.PT60的中断会自己嵌套自己: 手册中有提到,高优先级和同级中断都是可以抢占低优先级的。 我举个例子来说明: 现在有两个中断,1号中断--低优先级0级,2号中断--高优先级1级。 1号中断正在执行的过程中,此时2号中断过来打断了他,系统必然要先把2号中断执行完。之后再回去执行1号中断剩下的部分。但很不巧,此时新的1号中断又来了,就是说上一次的1号中断还没跑完,又被新的1号抢占了,也就是自己嵌套了自己,最后必然导致全部中断的时序都出现了问题。 这是一种潜在的隐患,我们的解决方法就是:让0级的1号中断一开始执行中断程序之后,让其把自身的中断等级提高一级,中断结束的时候在加上上面提到的恢复语句又变回0级。这样的话,我旧的1号中断(1级)还没执行完,新的一号中断(0级)即使来了,也无法抢占,必须乖乖的等着让旧的先执行完。下面这几条语句就是提高中断等级的,我们实验的时候让中断只有0和1级。   2.在执行asm cli指令之前必须要清除中断标志位: 接上,如果不清楚标志位的话就打开asm cli的话,那么系统就一直不断地让这个中断再进,也就是中断自己不断地在嵌套自己,最终把堆栈给压爆了,程序也就跑飞了。   东西很简单,但是确实值得注意。 附件是测试的程序,有需要的可以参考。 
View full article
Projects for WR-S08LL64.
View full article
Hi buddies ,      To share a design note to switch PWM channels and update duty in S08P series . Best regards, David
View full article
This is an use case when S08P ext. OSC is lost. To reset MCU automatically is a safe operation when the external clock is not stable based on our test.
View full article
Hello Community,   This document is intended for users who usually work with 8-bit MCU devices with the CodeWarrior IDE and are planning to migrate to the newest technologies such Kinetis and its corresponding IDE Kinetis Design Studio (KDS).   Mainly, this document shows how to create a new project using KDS, feature differences and the main software consideration involved on the migration process. Sample code for KE06 is attached.   I hope you find this material useful for you.
View full article
PT60 ADC FIFO,上周调试失败,今天中改了下ADC时钟,竟然莫名其妙的能够正常了,复原成原配置:bus clock = 8M,ADCK=bus clock=8M,无分频,这个时候ADC只采完了配置的第一个通道就卡死了,COCO一直被置位,无法继续工作。 PT60的ADC工作频率为0.4M~8M,我还怀疑了会不会是因为跑到ADC最高频率会有问题。 于是我将Bus clock变为16M,然后ADC的输入源变为BusCLK/2,即ADCK还是等于8M,这个时候FIFO确实正常工作的。       同样都是8M,所以就肯定不是配置或者其他逻辑上的问题了。 这个时候我就想可能会是MCU本身的bug了,就去查了MASKSET为0N53H的PT60 ERRATA, 果然发现ADC FIFO是有bug的   按照errata的说明,当bus clock小于ADCK/2的话,FIFO功能就会无法工作的。之后我使用异步时钟(典型值为3.3M)作为ADC的时钟源,然后在讲bus clock改为1M,这时候FIFO确实是无法工作了,但因为本身异步时钟的误差就很大,所以这个测试参考意义有限。 但这个情况和我遇到的还是不同的,我推论是:当ADC直接使用bus clock作为时钟源且不分频的话,ADC 的FIFO就无法工作。   之后我又实验很多次,在ADC的正常工作范围内,只要BusClk作为ADC的时钟源并不分频,FIFO功能都无法工作,所以这应该就是PT60的一个bug。 结论:在ADC的正常工作范围内,当ADC直接使用bus clock作为时钟源且不分频的话,ADC 的FIFO就无法工作。
View full article
Hi , There is a note to share with you to fix Freescale USB CDC Host Stack not working issue . If there any incorrect or other good idea , your comments would be appreciated . David
View full article
Hi, I have designed a simple programmer for the 9S08QG8 using an HC08JL3 and Serial Communication with the MON08 Interface. If you want to try it, please feel free to do that. I did that to give you another tool for QG8 programming. All the files are in a rar file, the password is inside the file (pass:QG8Programmer). If you build the interface and succed, please share it with the community. Thanks.
View full article
Hi everyone,   I would like to contribute to the Freescale Community sharing a simple project in which I have developed a customized USB communication through a Virtual COM (CDC). This project is based on a 8-bits microcontroller - particularly MC9S08JS family - working on CodeWarrior Development Studio 10.3. I attach a zip file with two internal files. One of them is the complete CodeWarrior project and the other is the USB CDC driver. Files are working properly, and obviously they are totally safe. Users only have to add their routines to send and receive data through endpoints functions.   I really hope that it can help someone to build a USB CDC project in an easier and faster way.   Best regards, Mauricio.
View full article