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

vEMAC Semaphore

Posted by Nobody/Anonymous on August 16, 2006
For the life of me, I'm looking at the code for the vEMAC lwIP demo and I cann see where the ISR gives the semaphore which wakes the processing task, but I cannot find where the semaphore is given back.

Maybe my short-sightedness is getting worse, but I've even tried searching in the files in the directory and cannot find it.

This leads me to believe that once the task is woken, it never goes back to sleep.

RE: vEMAC Semaphore

Posted by Richard on August 16, 2006
The lwIP task will block on the semaphore if there is nothing to do. The ISR will 'give' the semaphore, causing the lwIP task to 'take' the semaphore as it is woken. Now the semaphore is empty again.

If the semaphore were being use to guard access to a device, the task would now access the device then give the semaphore back.

However, in this case the semaphore is used for synchronisation only. It never gives the semaphore back so the semaphore remains 'empty'. When it tries to 'take' the semaphore it will again block. When the ISR executes again, writing to the semaphore again causes the lwIP task to wake.


Regards.

RE: vEMAC Semaphore

Posted by Nobody/Anonymous on August 16, 2006
With you, it blocks itself - d'oh moment.

which explains why my interrupt based driver for my external ethernet chip doesn't work....

Thanks!

RE: vEMAC Semaphore

Posted by Nobody/Anonymous on August 17, 2006
Is there an issue with portENTER_CRITICAL() and an FIQ interrupt?

My interrupt code for the ethernet driver was jumping off to data abort when I accessed the web server. The link register showed it was the FIQ interrupt that caused it, and that the address that caused it was inside this macro.

I got my boss to tie the FIQ line to the IRQ0 line and changed over the interrupt source and it all works fine, no jumping off to data abort.

Again, this is with the SAM7S256. It's all working fine from the IRQ0 interrupt but goes very pear shaped from the FIQ interrupt.

RE: vEMAC Semaphore

Posted by Nobody/Anonymous on August 17, 2006
Check the definition of your port to see if enter/exit critical macros disable just the IRQ or both the IRQ and FIQ.

If you allow FIQ interrupts within critical sections then you must ensure the FIQ does not access any of the queue or scheduler structures that are being protected by the critical section.

A quick solution would be to disable FIQ within a critical section also, but this may not be suitable for your application depending on the response you require for the FIQ interrupt.

Some time back there was a user that used the FIQ for fast motor commutation, and the IRQ for anything used by the scheduler. The critical section code then left the FIQ enabled.

What is the FIQ being used for?

RE: vEMAC Semaphore

Posted by Nobody/Anonymous on August 17, 2006
We were using the FIQ line because of a lack of other interrupt lines (2 woohoo!), but one of them I can live without, so on the next prototype the interrupt has been moved to a regular interrupt.

Problem solved. At least I know it's intended behaviour....


[ 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