/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / CTS interrupt when using SPI handshaking

Username:     
Password:     
             

Forum

# 1   2010-08-21 07:34:50 CTS interrupt when using SPI handshaking

wolverine_349
New member
Registered: 2010-08-21
Posts: 1

CTS interrupt when using SPI handshaking

Hi Guy,

My first post on this forum:-)....I am using SPI3 of STM32F103VG  to communicate with a slave device. The protocol is basically half duplex and relies on "command-wait-response " mechanism. Thus slave uses handshaking signals to let master know when to clock out the response from slave.

Now the handshaking signal used by slave is connected to CTS pin of USART3.My idea was to use this CTS interrupt and notify my task when to start clocking response via event(m using Embos OS).Question here is,can I configure CTS interrupt to be enabled without using turning on the uart ? Also the ISR for handling CTS will again be USART3 isr?

Offline

 

# 2   2010-08-23 12:48:06 CTS interrupt when using SPI handshaking

diabolo38
Member
Registered: 2010-03-12
Posts: 50

Re: CTS interrupt when using SPI handshaking

I guess you can't use CTS interrupt without enablign the  usart !
So maybe it would be simpler (no usart config required no over usart pins used) to configure and use your handcceck pins as an exti interrupt line ....

here is an example where i do triger interrupt on a falling edge of GPIO A.0  exti line (the gpio pin  is  already configure  as input + pull up)

Code:

 
#define STRIP_EXTI_LINE_NO   0
#define STRIP_EXTI_LINE   (1<<STRIP_EXTI_LINE_NO)
#define STRIP_EXTI_PORT_SRC  GPIO_PortSourceGPIOA
#define STRIP_EXTI_BIT_SRC   GPIO_PinSource0
#define STRIP_IRQ_CHANNEL EXTI0_IRQChannel
#define STRIP_IRQ_PRI 0   //same as timer 2
#define STRIP_IRQ_SUBPRI 0 //same as timer 2

void App_StripIrqHandler() __attribute__ ((interrupt ("IRQ")));
void App_StripIrqHandler() 
{
  // Do some stuff

    EXTI_ClearITPendingBit(STRIP_EXTI_LINE);
}

Init(){
    UTIL_SetIrqHandler(0x40+STRIP_IRQ_CHANNEL*4, App_StripIrqHandler);
    NVIC_InitStructure.NVIC_IRQChannel                    = STRIP_IRQ_CHANNEL ;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority  = STRIP_IRQ_PRI; 
    NVIC_InitStructure.NVIC_IRQChannelSubPriority         = STRIP_IRQ_SUBPRI;
    NVIC_InitStructure.NVIC_IRQChannelCmd                 = ENABLE;
    NVIC_Init(&NVIC_InitStructure);
    
    GPIO_EXTILineConfig(STRIP_EXTI_PORT_SRC, STRIP_EXTI_BIT_SRC);
    EXTI_InitStructure.EXTI_Line = STRIP_EXTI_LINE;
    EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
    EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
    EXTI_InitStructure.EXTI_LineCmd = ENABLE;
    EXTI_Init(&EXTI_InitStructure);  
    EXTI_ClearITPendingBit(STRIP_EXTI_LINE);
}

Last edited by diabolo38 (2010-08-23 12:55:29)

Offline

 

Board footer