Hello, I bought the Micromedia 7 board and now I want to call up data from Openweathermap via WiFi. However, the initialization of the WiFi module fails. Can anyone give me a simple example of wifi how to connect to the router's AP?
I will using it with WPA2.
First of all, which Libstock package is right?
Greetings Sascha
Micromedia 7 for STM32F4
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
Hi there,
since no answer has come up yet, here are a few results:
The Mikromedia example extends to the WiFi function. (Scan request denied. It just says connecting... )
The firmware update example works.
The keyboard example does not work. (Scan request denied. It just says connecting... )
Then I saw that in the examples Port F Bit 10 is used for both the TFT display and the Wifi module:
sbit TFT_BLED at GPIOF_ODR.B10;
sfr sbit Net_Wireless_SPWF01S_En at GPIOF_ODR.B10;
I now have a nice board, which was expensive enough. But this way I can nail it to the wall as a beautiful picture or burn it right away ......
since no answer has come up yet, here are a few results:
The Mikromedia example extends to the WiFi function. (Scan request denied. It just says connecting... )
The firmware update example works.
The keyboard example does not work. (Scan request denied. It just says connecting... )
Then I saw that in the examples Port F Bit 10 is used for both the TFT display and the Wifi module:
sbit TFT_BLED at GPIOF_ODR.B10;
sfr sbit Net_Wireless_SPWF01S_En at GPIOF_ODR.B10;
I now have a nice board, which was expensive enough. But this way I can nail it to the wall as a beautiful picture or burn it right away ......
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
On a Test Programm:
i see with a Logic Analyzer, ther is a Output on the Wifi Modul, but the STM32 send nothing....
Theres very Bad.
Code: Select all
#include "WifiTest2_objects.h"
#include "WifiTest2_resources.h"
//--------------------- User code ---------------------//
#include <stdint.h>
sbit Net_Wireless_SPWF01S_En at GPIOF_ODR.B10;
uint8_t wifiTest = 0, netReady = 0, tmpBuf[16384], strToSend[] = "0,0,0,0,0,0:ue\r";
char ipAddr[8];
char IPAdrStr[16];
uint8_t
rLedIdx = 0,
gLedIdx = 0,
bLedIdx = 0,
kbIdx = 0,
rQuery = 0,
gQuery = 0,
bQuery = 0,
kbQuery = 0;
// Timer interrupt
void incTimer() iv IVT_INT_TIM2
{
TIM2_SR.UIF = 0;
Net_Wireless_SPWF01S_IncTimer();
}
// UART interrupt
void asyncReq() iv IVT_INT_USART6 ics ICS_AUTO {
Net_Wireless_SPWF01S_Process(UART_Read());
}
// Convert IP address to string
void ConvertIPtoString() {
char txt[6];
char txt1[6];
char txt2[6];
char txt3[6];
// Divide IP address to four strings :
ByteToStr(ipAddr[0], txt);
strcat(txt, ".");
Ltrim(txt);
strcat(IPAdrStr, txt);
ByteToStr(ipAddr[1], txt1);
strcat(txt1, ".");
Ltrim(txt1);
strcat(IPAdrStr, txt1);
ByteToStr(ipAddr[2], txt2);
strcat(txt2, ".");
Ltrim(txt2);
strcat(IPAdrStr, txt2);
ByteToStr(ipAddr[3], txt3);
Ltrim(txt3);
strcat(IPAdrStr, txt3);
}
// matching with known string
uint8_t matchResponse( uint8_t newChr, uint8_t* knMsg, uint8_t* idx ) {
// compare read char with tracking character in the string
if (newChr == *(knMsg + *idx)) {
// update tracking index
(*idx)++;
// if we reached the end of the known string, exit with success msg
if (*(knMsg + *idx) == 0) {
*idx = 0;
return 1;
}
}
// if no match, reset tracking index and compare again
else {
*idx = 0;
if (newChr == *knMsg) {
// update tracking index
(*idx)++;
}
}
// nothing, yet
return _NET_WIRELESS_SPWF01S_OK;
}
// wind callback
int8_t AsyncCb( uint32_t WID, uint8_t* windResp) {
// wifi is up
if ( Net_Wireless_SPWF01S_GetWID() == _NET_WIRELESS_SPWF01S_WID_CONNECT_OK) {
netReady = 1;
}
// input is waiting
if ((Net_Wireless_SPWF01S_GetWID() == _NET_WIRELESS_SPWF01S_WID_INPUT_REQ ) && (netReady == 1)) {
// insert LED data
strToSend[0] = ODR1_GPIOD_ODR_bit + '0';
strToSend[2] = ODR2_GPIOD_ODR_bit + '0';
strToSend[4] = ODR3_GPIOD_ODR_bit + '0';
// insert button data
strToSend[6] = IDR5_GPIOD_IDR_bit + '0';
strToSend[8] = IDR6_GPIOD_IDR_bit + '0';
strToSend[10] = IDR7_GPIOD_IDR_bit + '0';
UART_Write_Text(strToSend);
}
}
// user callback
int8_t UsrCb(uint8_t readData) {
// toggle LEDS
if ( matchResponse(readData, "led1" , &rLedIdx) == 1) {
//ODR1_GPIOD_ODR_bit = ~ODR1_GPIOD_ODR_bit;
}
if (matchResponse(readData, "led2" , &gLedIdx) == 1) {
//ODR2_GPIOD_ODR_bit = ~ODR2_GPIOD_ODR_bit;
}
if ( matchResponse(readData, "led3" , &bLedIdx) == 1 ) {
//ODR3_GPIOD_ODR_bit = ~ODR3_GPIOD_ODR_bit;
}
return _NET_WIRELESS_SPWF01S_OK;
}
// Init MCU
void initWifi() {
// set SPWF01S UART
UART6_Init_Advanced(115200, 8, 0, 1, &_GPIO_MODULE_USART6_PC67);
Delay_ms(100);
UART6_Enable();
// set LED pins as ouput
GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_1 | _GPIO_PINMASK_2 | _GPIO_PINMASK_3 );
// set buttons as input
GPIO_Digital_Input( &GPIOD_BASE, _GPIO_PINMASK_5 | _GPIO_PINMASK_6 | _GPIO_PINMASK_7 );
// enable RX interrupt
RXNEIE_USART6_CR1_bit = 1;
NVIC_IntEnable(IVT_INT_USART6);
EnableInterrupts();
UART_Set_Active(&UART6_Read, &UART6_Write, &UART6_Data_Ready, &UART6_Tx_Idle);
// init timer 2: IRQ@1s
RCC_APB1ENR.TIM2EN = 1;
TIM2_CR1.CEN = 0;
TIM2_PSC = 1124;
TIM2_ARR = 63999;
NVIC_IntEnable(IVT_INT_TIM2);
TIM2_DIER.UIE = 1;
TIM2_CR1.CEN = 1;
// set callbacks
Net_Wireless_SPWF01S_RegisterAsyncDataHandler(AsyncCb);
Net_Wireless_SPWF01S_RegisterUserHandler(UsrCb);
Delay_ms(100);
// wifi module init
Net_Wireless_SPWF01S_Init();
Delay_ms(500);
// connect to the network
netReady = 0;
// Connect to network
if (( wifiTest = Net_Wireless_SPWF01S_ConnectToAP("xxxxxxxxx", "xxxxxxxxxxxxxxx", 0)) == _NET_WIRELESS_SPWF01S_OK) {
// wait for WiFi to be up
while (netReady == 0)
;
// Get IP address
Net_Wireless_SPWF01S_GetCurrentIP(ipAddr);
// Convert IP address to string
ConvertIPtoString();
}
}
//----------------- End of User code ------------------//
// Event Handlers
Theres very Bad.
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
Have anyone a Code??
Re: Micromedia 7 for STM32F4
Hi,
Regards,
Filip.
Can you please elaborate on this ?see with a Logic Analyzer, ther is a Output on the Wifi Modul, but the STM32 send nothing....
Regards,
Filip.
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
Hi there,
After the program start, the STM32 only sends 0xFE, the Wifi module, sends its version etc, then Wifi start scanning, scanning and scanning finished. Scanning is repeated every 10 seconds. However, not a single communication can be seen from the STM32. Not a single AT command. However, if I reload the program that was delivered from the factory, it does find some WiFi networks, but it does not help me. So I need a simple example of how to get the module running (HTTP client).
I try the whole time with the lib "https://libstock.mikroe.com/projects/vi ... fi-library"
Greetings Sascha
After the program start, the STM32 only sends 0xFE, the Wifi module, sends its version etc, then Wifi start scanning, scanning and scanning finished. Scanning is repeated every 10 seconds. However, not a single communication can be seen from the STM32. Not a single AT command. However, if I reload the program that was delivered from the factory, it does find some WiFi networks, but it does not help me. So I need a simple example of how to get the module running (HTTP client).
I try the whole time with the lib "https://libstock.mikroe.com/projects/vi ... fi-library"
Greetings Sascha
- Attachments
-
- Wifi.png (26.01 KiB) Viewed 3106 times
-
- STM32_TXD.png (32.05 KiB) Viewed 3106 times
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
Hi,
after some Tests with AT Commans, i see with a Logic Analyzer, the Response from the Wifi Modul is everytime Error: Command not found.
Thats very bad. Regards Sascha
after some Tests with AT Commans, i see with a Logic Analyzer, the Response from the Wifi Modul is everytime Error: Command not found.
Thats very bad. Regards Sascha
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
Hi there,
I haven't gotten any further so far. Does micro have the firmware for the wifi module? There is nothing to be found at ST. Any other ideas? Not much comes from the support .....
Greetings Sascha
I haven't gotten any further so far. Does micro have the firmware for the wifi module? There is nothing to be found at ST. Any other ideas? Not much comes from the support .....
Greetings Sascha
Re: Micromedia 7 for STM32F4
Hi,
I will try the WiFi and upload the example ASAP.
Regards,
Filip.
I will try the WiFi and upload the example ASAP.
Regards,
Filip.
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
Hello,
any News?
Regards Sascha
any News?
Regards Sascha
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
Hello,
any News? I`m testing different Libstock Versions with the same Result.
Regards Sascha
any News? I`m testing different Libstock Versions with the same Result.
Regards Sascha
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
Hello,
i am frustrated, After more than 5 Weeks no result.
Regards Sascha
i am frustrated, After more than 5 Weeks no result.
Regards Sascha
-
- Posts: 12
- Joined: 15 Jul 2018 16:42
Re: Micromedia 7 for STM32F4
After three months I'm still no further and also for more than three months no further support as announced. This is really disappointing. Do I now have a €200 board that I should let gather dust in the closet? Or take it to the recycling center?