element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
STM32F4DISCOVERY Expansion Boards
  • Products
  • Dev Tools
  • STM32F4DISCOVERY Expansion Boards
  • More
  • Cancel
STM32F4DISCOVERY Expansion Boards
Forum How to use the other UART in sn8200(Discover Wi-Fi)?
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join STM32F4DISCOVERY Expansion Boards to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 7 replies
  • Subscribers 6 subscribers
  • Views 1206 views
  • Users 0 members are here
  • frontpage
Related

How to use the other UART in sn8200(Discover Wi-Fi)?

Former Member
Former Member over 9 years ago

Hello,

I am a new in this conversation;

 

I have difficulty handling Discover Wi-Fi.

Currently, I am using keil vision and stm32f407 as a host mcu device

Also, I am trying to modify the example code but it is not working well. I need help and advice.

In the example, PB6 and PB7 are used to communicate with host mcu. Unfortunately, I have already assigned these pins to the another function. So I changed and tried several times such as UART1 to UART2, UART1 to UART3 and UART1 to UART1(PA9,PA10)

Surprisingly, It is only operated in PB6,PB7....

 

Does anybody know what happen in here and how to change it?

I tried the EWW website and others... it did not work..

 

I am really looking forward to meeting your answer.

 

Thanks

  • Sign in to reply
  • Cancel
Parents
  • clem57
    clem57 over 9 years ago

    Can you first remove other things and just get demo working? That way we can eliminate hardware issues.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • clem57
    clem57 over 9 years ago

    Can you first remove other things and just get demo working? That way we can eliminate hardware issues.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Former Member
    Former Member over 9 years ago in reply to clem57

    I checked the demo at first when I use it.

    I tested all the functions and it was working very well.

    Unfortunately, It doesn't work only for other UART function and I checked wiring between the mcu and wifi.

     

    Could you give me another solution for me?

     

    Thanks

     

    MJ

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • clem57
    clem57 over 9 years ago in reply to Former Member

    Can you post the changes to the demo only? Otherwise can you move your parts to other pins?

    Thanks,

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to clem57

    Firstly, Thanks for reply.

    -For the software

    I changed below code. Below code is given and I changed USART1 --> USART2

    and pin assignment are changed to PA2 as a Tx and PA3 as a RX.

    Also UART CLOCK is changed APB2 --> APB1.

     

    -For the hardware

    I wired PA2 with   RX pin and PA3 with  SN8200SN8200 TXpin

    void SN8200_HAL_Init(uint32_t baudrate)

    {

        GPIO_InitTypeDef GPIO_InitStructure;

        USART_InitTypeDef USART_InitStructure;

        NVIC_InitTypeDef NVIC_InitStructure;

     

     

        /* Enable GPIO clock */

        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);

     

     

        /* Enable UART clock */

        RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);

     

     

     

     

        /* Connect PXx to USARTx_Tx*/

        GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_USART1);

     

     

        /* Connect PXx to USARTx_Rx*/

        GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_USART1);

     

     

        /* Configure USART Tx as alternate function  */

        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

     

     

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;

        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

        GPIO_Init(GPIOB, &GPIO_InitStructure);

     

     

        /* Configure USART Rx as alternate function  */

        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;

        GPIO_Init(GPIOB, &GPIO_InitStructure);

     

     

        NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);

     

     

        /* Enable the USART1 Interrupt */

        NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;

        NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

        NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

        NVIC_Init(&NVIC_InitStructure);

     

     

        /* USART configuration */

        USART_InitStructure.USART_BaudRate = baudrate;

        USART_InitStructure.USART_WordLength = USART_WordLength_8b;

        USART_InitStructure.USART_StopBits = USART_StopBits_1;

        USART_InitStructure.USART_Parity = USART_Parity_No;

        USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

        USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

     

     

        USART_Init(USART1, &USART_InitStructure);

     

     

        USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);

     

     

        /* Enable USART */

        USART_Cmd(USART1, ENABLE);

    }

     

     

     

     

    void SN8200_HAL_SendData(unsigned char *buf, int len)

    {

        int i;

     

     

        for (i = 0; i < len; i++) {

            USART_SendData(USART1, buf[i]);

            while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);

        }

    }

     

     

    bool SN8200_HAL_RxBufferEmpty(void)

    {

        return (RxBufferHead == RxBufferTail);

    }

     

     

    uint8_t SN8200_HAL_ReadByte(void)

    {

        uint8_t data = 0;

     

     

        if(RxBufferHead != RxBufferTail) {

            data = RxBuffer[RxBufferTail];

            RxBufferTail = (RxBufferTail + 1) % RX_BUFFER_SIZE;

        }

     

     

        return data;

    }

     

     

    void USART1_IRQHandler(void)

    {

        if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) {

            RxBuffer[RxBufferHead] = USART_ReceiveData(USART1);

            RxBufferHead = (RxBufferHead + 1) % RX_BUFFER_SIZE;

        }

    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to clem57

    @Clem

    I found one problem.

    A problem is that Tx pin is not changed even if I changed it code well.

     

    1. Given example , Tx, Rx are assigned PB6,PB7 respectively.

    2. I changed it to UART2 and Tx, Rx are assigned PA2,PA3 respectively and wiring is also well.

    3. I scope PA2 and PA3 then, PA3 state is high butt PA1 is low.

    and I also scope to UART1 which are PB6 and PB7. PB6 is still high and PB7 is low.

     

    Summary: Only UART Tx is not changed...

    Could you give me advice and share your idea with me?

    It would be very helpful

    Thanks 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • clem57
    clem57 over 9 years ago in reply to Former Member

    2. I changed it to UART2 and Tx, Rx are assigned PA2,PA3 respectively and wiring is also well.

    3. I scope PA2 and PA3 then, PA3 state is high butt PA1 is low.

    and I also scope to UART1 which are PB6 and PB7. PB6 is still high and PB7 is low.

    Is this a typo?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to clem57

    I am sorry

    I made terrible typo..

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube