Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

addiing support for i2c communication to RTOS

Posted by CMOS on February 19, 2008
hi,
im working with MPLAB port of RTOS and it works fine. the device im using is 18f4455. i need to extend the functionality of RTOS with i2c support for this (or for whole 18F devices) device. however im not exactly sure how this kind of kernal level functionality should be added to RTOS. So im looking for some advice/tutorials on how to get started.
and also please let me know if there are already written extensions for i2c for MPLAB port and 18F devices.


thanks
CMOS

RE: addiing support for i2c communication to RTOS

Posted by Dave on February 19, 2008
You should find a demo UART driver for each port in the download that can be used as a model for all drivers. Also take a look at the WIZNET demo source code as this includes an I2C driver, although the syntax will be different as its running on an ARM it will give you the basics.

RE: addiing support for i2c communication to RTOS

Posted by Anuradha on January 11, 2011
Hello,

Am not clear in what you have meant as "WIZNET" :-Q

RE: addiing support for i2c communication to RTOS

Posted by Jack Peacock on January 11, 2011
A few years ago I added I2C to FreeRTOS for an STR750 (ARM7TDMI). The concept was a device driver that ran a "transaction" with a peripheral device: send command, wait for response. I used a mutex flag to serialize access to the device driver, and a completion semaphore to block the originating task until the transaction completed (or timed out). The data transfer was handled in an interrupt service routine which set the completion flag when the I2C was done.

The mutex was needed because I had two devices on the I2C bus, with a separate task for each device. The mutex ensured that commands and responses were in serial order and data went to the right task. Both tasks used the same completion flag but since the mutex blocked the second task while the first was using I2C there was no conflict.

The other trick on I2C is being able to recover from a fault. In my case I had to shut off the I2C logic, switch to bit bang mode, and manually clock out 9 bits to clear the I2C bus if a peripheral hung (it happens, don't expect perfection). Without the timeout if a peripheral fails to respond to a command the bus hangs forever waiting for the response.
Jack Peacock


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists