Clicker 2 for STM32 Non Communication

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
johannvd
Posts: 5
Joined: 12 Apr 2020 04:08

Clicker 2 for STM32 Non Communication

#1 Post by johannvd » 18 Apr 2020 13:51

Good day,

New to programming HW and using C so please bear with me.

Equipment:
  • Clicker 2 for STM32
  • BLE 8 Click
  • RS485 3 Click
  • MicroC PRO for ARM
  • ST-LINK V2 Programmer/Debugger
I'm using the BLE 8 Click example and it appears that the Clicker 2 might not be communicating with the BLE module.
It seems to be stuck in the following code section which is part of the applicationInit() function

Code: Select all

  mikrobus_logWrite( "ENTER COMMAND MODE? [Y/N]", _LOG_LINE );
    
    while ((cmd_en != 'y') && (cmd_en != 'Y') && (cmd_en != 'n') && (cmd_en != 'N'))
    {
        cmd_rdy = UART_Rdy_Ptr();

        if (cmd_rdy != _RX_NOT_READY)
        {
		cmd_en = UART_Rd_Ptr();
            
            if ((cmd_en == 'y') || (cmd_en == 'Y'))
            {
                mikrobus_logWrite( "COMMAND MODE ENTERING...", _LOG_LINE );
            
                ble8_set_dsr_pin( 1 );
                Delay_ms( 20 );
                ble8_set_dsr_pin( 0 );
                Delay_ms( 20 );
                
                ble8_set_echo_cmd( _BLE8_ECHO_OFF );
            }
            else if ((cmd_en == 'n') || (cmd_en == 'N') )
            {
                mikrobus_logWrite( "DEFAULT MODE ENTERING...", _LOG_LINE );
            }
        }

    }

Not sure how to test exactly if the module is communicating but it does not get past the section above because cmd_rdy never gets updated and stays = 0.
Output is directed to the microbus 2 using the RS485 module which is wired back to my PC and using Putty I can see the output but cannot respond with a y/n.

Any help is much appreciated.

Thanks,
Johann

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Clicker 2 for STM32 Non Communication

#2 Post by filip » 24 Apr 2020 07:02

Hi,

Does the issue still persists ?

Regards,
Filip.

johannvd
Posts: 5
Joined: 12 Apr 2020 04:08

Re: Clicker 2 for STM32 Non Communication

#3 Post by johannvd » 25 Apr 2020 05:02

filip wrote:
24 Apr 2020 07:02
Hi,

Does the issue still persists ?

Regards,
Filip.
Morning Filip,

Thank you for responding to my question, unfortunately it does still persist.

I've changed the code to continue without a Y/N entered.

I have tried to set the name in the mean time but that also does not look like it is working. Here is the code, I have tried to set the name before and after the

Code: Select all

ble8_reset();
in the applicationInit function. The set name function looks like this

Code: Select all

ble8_set_echo_cmd( _BLE8_ECHO_ON );
Delay_ms( 10 );
ble8_set_local_name_cmd("ANNA-B1-AABBCC");
Delay_ms( 10 );
ble8_set_echo_cmd( _BLE8_ECHO_OFF );
ble8_store_cnfg_cmd();
I am able to connect the the BLE module using an app on my phone and can also write to the one custom characteristic, looking at the code it is my understanding that the data should be echoed on the log output but I do not see that at all.

Not trying to confuse the situation more but I am just trying to work through this and have a better understanding.

Thanks,
Johann

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Clicker 2 for STM32 Non Communication

#4 Post by filip » 28 Apr 2020 07:33

Hi,

Did you set the MCU clock correctly ?
This is the most common issue with the UART communication so please check this first - see if the UART is transmitting/receiving on the correct baud rate.

Regards,
Filip.

johannvd
Posts: 5
Joined: 12 Apr 2020 04:08

Re: Clicker 2 for STM32 Non Communication

#5 Post by johannvd » 30 Apr 2020 04:43

filip wrote:
28 Apr 2020 07:33
Hi,

Did you set the MCU clock correctly ?
This is the most common issue with the UART communication so please check this first - see if the UART is transmitting/receiving on the correct baud rate.

Regards,
Filip.
Hi Filip,

MCU clock is set to 140 MHz and the baud rate is 9600 bps - please indicate if that is correct and also advise where I can obtain this information in general as to avoid making the same mistake with other modules.

Thanks,
Johann

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Clicker 2 for STM32 Non Communication

#6 Post by filip » 30 Apr 2020 09:54

Hi,

Yes, you may use 140 MHz but you also must set the configuration bits accordingly, so I suggest that you load the STM32F407VG_PLL_Int_Osc_16MHz_to_140MHz configuration bits scheme from the Project -> Edit Project window.

As for the baud rate, the default value in the BLE8 click example is 115200, so please try this.

Regards,
Filip.

johannvd
Posts: 5
Joined: 12 Apr 2020 04:08

Re: Clicker 2 for STM32 Non Communication

#7 Post by johannvd » 03 May 2020 08:30

filip wrote:
30 Apr 2020 09:54
Hi,

Yes, you may use 140 MHz but you also must set the configuration bits accordingly, so I suggest that you load the STM32F407VG_PLL_Int_Osc_16MHz_to_140MHz configuration bits scheme from the Project -> Edit Project window.

As for the baud rate, the default value in the BLE8 click example is 115200, so please try this.

Regards,
Filip.
Morning Filip,

Thank you for the information.

The configuration as per your post was previously loaded and confirmed, the baud rate was in fact configured as 115200 (I was mistaken previously stating 9600). The problem remains.

I have changed the sample application to try and get the module information which is included in the original code and that also does not work - herewith the source file.
Click_BLE_8_STM.zip
(4.2 KiB) Downloaded 65 times
I had to change the log output as this is not the same board as the original example used. There is a FTDI cable connected on MikroBUS2 socket for the logging. Only 2 pins are connected RX <> TX & TX <> RX , the logging is displayed as expected.

It would be good to get the sample working but could I ask that if that is not possible if you can create a sample to pass data to and from the module, set name and get the info perhaps?

Thanks,
Johann

johannvd
Posts: 5
Joined: 12 Apr 2020 04:08

Re: Clicker 2 for STM32 Non Communication

#8 Post by johannvd » 15 May 2020 03:51

Morning Filip,

Have you perhaps had a chance to look at my previous post?

Your feedback will be much appreciated!

Thanks,
Johann

Post Reply

Return to “mikroC PRO for ARM General”