Keil Uvision Serial

2021年1月7日
Download: http://gg.gg/nrk32
In this tutorial, we will learn to use I2C communication modules of TM4C123G microcontrollers. The TM4C123GH6PM microcontroller which is integrated on the Tiva Launchpad board has four I2C channels inside the chip such as 12C0, 12C1, 12C2, and I2C3. Firstly, We will use a bare-metal embedded approach to configure I2C modules using peripheral registers. Keil uvision IDE will be used to write program for I2C master and slave configuration.
The on-chip serial port is controlled with: S0TIME, S0IN, and S0OUT. S0IN and S0OUT represent the serial input and output streams on the CPU. S0TIME lets you specify whether the serial port timing instantaneous (STIME = 0) or the serial port timing is relative to the specified baudrate (SxTIME = 1).
Accessing Serial Flash Memory using SPI Interface - Libero SoC v11.5 and Keil uVision Flow Tutorial for SmartFusion2 Introduction The Libero® System-on-Chip (SoC) software generates firmware projects using Keil, SoftConsole, and IAR tools. This tutorial describes the process to build a Keil uVision application that can be implemented. Keil Mdk Arm 5 Keygen. You don’t find out any Crack Serial Keygen. All in all, it is a professional environment for electrical engineers to program different microcontrollers. It includes μVision and provides compilers for C and C to handle different development needs. How to use printf in keil uvision? Or How to retarget printf for my ARM microcontroller? Also, after learning UART programming an obvious though would be like, how can I redirect printf to UART/Serial port in keil and print the debug output on my PC using Terminal software?I2C Communication Introduction
I2C is also known as an inter-integrated circuit or IIC or I square C. It is a synchronous half-duplex serial communication protocol. Furthermore, it is a multi-master bus protocol that requires only two wires to transfer data serially that are SCL and SDA.
*SDA ( Bidirectional data line)
*SCL ( Bidirectional clock line)I2C Bus Connection
Each device connected with the I2C bus can be either in master mode or in slave mode. But only a master device can initiate the data transfer process. Usually, there are one master and one slave or multiple slave devices connects with the same I2C bus through pull-up resistors. Each salve address has a 7-bit unique address.
For example, if we configure the TM4C123G Tiva launchpad as a master device and we can connect multiple slave devices with the same bus.
For more information on I2C Communication, you can read this post:TM4C123G I2C Communication Modules
As we mentioned earlier, TM4C123 microcontrollers have four I2C modules inside the chip. Moreover, each module can be configured either as a master, slave, or both master and slave at a time.I2C Pins TM4C123 Tiva
This table shows the clock line and data line pins of each I2C module on TM4C123 pinout.
As you know that each GPIO pin of microcontroller has multiple functions or these pins are shared with different peripherals using multiplexing techniques. But each pin can be used for one peripheral or for one function at a given time. A peripheral select register is used to enable or disable the alternate function of every pin.
All these I2C modules supports four data transmission speeds.
*Standard (100 Kbps)
*Fast-mode (400 Kbps)
*Fast-mode plus (1 Mbps)
*High-speed mode (3.33 Mbps)Steps configure TM4C123 I2C module as a Master
As we mentioned earlier, each I2C module can be configured either as a master or a slave. In this tutorial, we will see steps to configure the I2C3 module as a master. But you can follow the same steps to configure any I2C module in both master and slave configurations.Enable Clock
*Enable clock to I2C3 module and GPIO pins which are used as SDA and SCL pins using RCGC12C3 and RCGCGPIO registers.
*Also, disable the ADC alternate functions of RD0 and RD1 pins using the GPIOAFSEL register and select the I2C3 alternate function using the GPIOPCTL register.
*Select Open drain operation for the I2CSDA pin that is the RD1 pin.
*Enable Master mode by setting appropriate bits of I2C3->MCR register.Select Clock Speed
For example, we want to use speed of 100kbps. Select clock speed of 100kbps by using this formula:
(1 + TIME_PERIOD ) = SYS_CLK /(2*( SCL_LP + SCL_HP ) * I2C_CLK_Freq )TIME_PERIOD = 16 ,000 ,000/(2(6+4) *100000) – 1 = 7
Load this time period value to I2C3->MTPR register.Master Transmit Data
*Specify the slave address of the master and that the next operation is a Transmit by writing the
*I2CMSA register with a value of 0x0000.0076. This sets the slave address to 0x3B.
*Place data (byte) to be transmitted in the data register by writing the I2CMDR register with thedesired data.
*Initiate a single byte transmit of the data from Master to Slave by writing the I2CMCS register with a value of 0x0000.0007 (STOP, START, RUN).
*Wait until the transmission completes by polling the I2CMCS register’s BUSBSY bit until it has been cleared.
*Check the ERROR bit in the I2CMCS register to confirm the transmit was acknowledged
You can follow the same steps to configure master to receive data from the slave.TM4C123 I2C Code
In this code, we initialized the I2C3 module of TM4C123 microcontroller as a master. This example code can be used to transmit and receive multiple bytes. As you can see in this picture, RD0 and RD1 are data line and clock line pins of I2C3 module.I2C Communication between Arduino and TM4C123 Launchpad
In order to test above code, we will peform I2C communication between Arduino and Tm4c123 Tiva launchpad. Arduino will be configured as a slave and TM4C123G microcontroller as a master. We will send an instruction from tiva launchpad to Arduino over I2C bus. The instruction will either turn on or turn off on board LED of Arduino board.
Make connection between Tiva C and Arduino according to this circuit diagram:
Upload this code to your Arduino Board. This Arduino code uses the I2C module of Arduino as a slave and the address assign to this slave device is 4. If a character received by this device is 0x00, it will turn on the onboard LED of Arduino and if a character received by this device is 0x01, it will turn off the onboard LED.
Pin A5 is clock, or SCL, pin) and pin 4 is a data, or SDA pin of Arduino Uno.
Upload this code to TM4C123G Tiva C Launchpad. This example code uses an onboard push button to transmit data to Arduino. If the push button is pressed, TM4C123 Tiva launchpad, transmit 0x00 and if not pressed, it transfers 0x01 via the I2C3 module.Video Demo
Related Articles:
Technical Support
On-Line Manuals
µVision User’s GuideAbout µVisionUser InterfaceCreating ApplicationsDebuggingStart DebuggingStart Energy Measurement without DebugApplication Program ExecutionDebug Windows and DialogsBreakpoints WindowCall Stack and Locals WindowCode CoverageCommand WindowComponent ViewerDisassembly WindowEditor WindowEvent RecorderSetup Event RecorderEvent Recorder WindowEvents FilteringEvent Statistics WindowPost-mortem AnalysisEvent ViewerExecution ProfilerInstruction Trace WindowSystem AnalyzerUsage tipsSave System Analyzer ContentsStatisticsRestrictionsLogic AnalyzerSetupSetup in DetailRestrictionsCortex-M Trace ConfigurationMemory MapMemory WindowPerformance AnalyzerRegisters WindowSerial WindowDebug (printf) ViewerSymbols WindowSystem ViewerAdding System Viewer WindowsSystem and Thread ViewerThread StatesToolboxTrace Data WindowTrace NavigationTrace ExceptionsEvent CountersULINKplus WindowWatch WindowCore PeripheralsCortex-M0 and Cortex-M0+Nested Vector Interrupt ControllerSystem Control and ConfigurationSystem Tick TimerFault Reports (Cortex-M0+ only)Cortex-M3, Cortex-M4, and Cortex-M7Nested Vector Interrupt ControllerSystem Control and ConfigurationSystem Tick TimerFault ReportsMemory Protection UnitCortex-M23/M33/M35P and Cortex-M55Nested Vector Interrupt ControllerSystem Control and ConfigurationKeil Software DownloadSystem Tick TimerFault ReportsMemory Protection UnitSecurity Attribution UnitM-Profile Vector Extension (MVE)Debug ScriptingExpressionsConstantsSystem VariablesPeripheral VariablesI/O PortsSerial PortsProgram Variables (Symbols)Fully Qualified SymbolsNon-Qualified SymbolsLiteral SymbolsUsing SymbolsLine NumbersBit AddressesType SpecificationsMemory Attribution SpecifiersOperatorsDifferences between µVision and CExpression ExamplesCode and Data Trace (Cortex-M)Trace FeaturesConfiguring TraceTracepoint ExpressionsKeil Uvision Software DownloadTracepoint IntrinsicsTracepoint LimitationsTracepoint MarksTips and TricksReview Peripherals and CPU ConfigurationSimulate I/O PortsSimulate Interrupts and Clock InputsSimulate external I/O DevicesAssign Serial I/O to a PC COM PortCheck Illegal Memory AccessCommand Input from FilePreset I/O Ports or Memory ContentsWrite Debug Output to a FileKeyboard ShortcutsTPIU Initialization after RESET (Cortex-M)Prevent Opening FilesShow Japanese MessagesDebug CommandsDebug FunctionsSimulationFlash ProgrammingDialogsUtilitiesCommand LineExample ProgramsAppendix
The Serial window accepts serial input and output data streams. The window displays serial output data received from a simulated CPU, while characters typed into a serial window are input to the simulated CPU. This allows testing a UART interface prior to having the target hardware.
The Debug (printf) Viewer is a special serial window that can exchange data with the microcontoller. For Cortex-M microcontrollers, the window displays printf-data received from the Instrumentation Trace Macrocell (ITM). To redirect output, refer also to Retarget Output via ITM, and Debug Access in the CMSIS documentation.
Open these windows using the toolbar button or the menu View - Serial Windows.
The Context Menu allows:
*Clearing the window.
*Copying and saving the content to the clipboard or a file.
* Setting a Carriage Return to every Line Feed that is received (enabled by default).
* Switching to various representation modes. Terminal ModeText formatting and cursor control sequences are supported (see table below).ASCII ModeEvery printable character is displayed. An unprintable character is displayed as white-space (’ ’).HEX ModeEvery character is displayed as a HEX-number.Mixed ModeEvery character is displayed as a HEX-number and ASCII character. An unprintable character is displayed as dot (’.’).
ANSI VT100 Terminal SequencesSequenceDescriptionFrom Target −→ µVisionCR (’r’)Carriage ReturnLF (’n’)Line FeedTAB (’t’)TabulatorBS (0x08)Back SpaceBEL (0x07)Bell<ESC>[CMove cursor (position) 1 to the right<ESC>[DMove cursor (position) 1 to the left<ESC>[KDelete line right to cursor<ESC>[JClear screen<ESC>[y;xfSet cursor to Row y, Column x; (x,y) are numeric ASCII valuesFrom µVision ⇒ Target<ESC>[ACursor Key UP<ESC>[BCursor Key DOWN<ESC>[CCursor Key RIGHT<ESC>[DCursor Key LEFT
ExamplesKeil Uvision Serial Killer
See also
*Assign Serial I/O to a PC COM Port using the debug command ASSIGN.
*SLOG the debug command to redirect serial output to a file.
*Low Level I/O Routines redirect serial communication to a different UART or peripheral.
*UART Communication provides examples of UART simulation, peripheral dialogs, VTREG’s, or controlling UART communication timing.
*Debug (printf) Viewer usage when debugging hardware with ULINKpro. Keil Uvision Product Serial NumberProductsDevelopment ToolsHardware & CollateralDownloadsSupportContact
Cookie Settings | Terms of Use | Privacy | Accessibility | Trademarks | Contact Us | Feedback
Copyright © 2005-2019 Arm Limited (or its affiliates). All rights reserved.
Download: http://gg.gg/nrk32 https://diarynote-jp.indered.space

コメント

お気に入り日記の更新

テーマ別日記一覧

まだテーマがありません

この日記について

日記内を検索