cyw94343wwcd1 on board initialization causes SPI pins reassigned to PWM(shared pins) to power on and off during init, how do I turn this off

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GiHe_2512991
Level 1
Level 1

Sorry forgot to add the board we are working with.

cyw94343wwcd1 on board initialization causes SPI pins reassigned to PWM(shared pins) to power on and off during init, how do I turn this off or /dev/null SPI so no action is taken on boot/init or reset?????

This would cause motors to turn on during initialization and reset  that use these GPIO's which is not a good thing.

With the CYW94343WWD1 eval board, we are having an issue on boot with the WICED_PWM_# pins we are using.  The issue is that they appear to be bound to the same GPIO pins like MICRO_SPI_MISO and others that during boot turn on and off.  These Pins are all allocatable as PWM but on initiailization they turn on and off multiple times even after a reset on the dev board.This results in these GPIO pins that are used as PWM output pins being turned on and off as well during resets, when they should not be on at all.

CYPRESS GPIO 94343 to dev board and breakaway
WICED SDKSTM32f411BCM94343PIN#Interface
WICED_PWM_1WICED_GPIO_11MICRO_GPIO_021J7
WICED_PWM_2WICED_GPIO_26MICRO_GPIO_124J7
WICED_PWM_3WICED_GPIO_2MICRO_ADC_IN116J7
WICED_PWM_4WICED_GPIO_3MICRO_ADC_IN215J7
WICED_PWM_5WICED_GPIO_4MICRO_ADC_IN318J7
WICED_PWM_6WICED_GPIO_6MICRO_SPI_SCK20J7
WICED_PWM_7WICED_GPIO_7MICRO_SPI_MISO19J7
WICED_PWM_8WICED_GPIO_8MICRO_SPI_MOSI22J7
WICED_PWM_9WICED_GPIO_2MICRO_ADC_IN116J7

The questions we have from this are:

  • Is there a way to disable signals being sent out of these GPIO pins during boot?
  • If there is a way to stop it, how do we do that?

from a Prior forum question answered by Priyam_16

Using cyw94343  their are only 2 PWM GPIO's assigned need more??

This question has been Answered.

   Gillian Hernandez Level 3

 

Hello all using cyw94343,  cypress has only 2 PWM cpio's assigned with this model,   I need to create a total of 4 - 6 to control motors, driven off this

device.   Which libraries do   i need to add to or duplicate from give me a total 4 or 6 assignment's of  GPIO's to test this with. This being software driven are

their specific physical  restrictions in re-using the existing non pwm GPIO's, and re-assigning them to PWM GPIO actions, it should be a library assignment and header .h

creation or  duplication issue ??

Let me know if i'm off track here    thanks ahead of time to y'all.

PriyaM_16
Correct Answer by PriyaM_16 on Jun 21, 2019 4:14 AM

Hello,

You can use the WICED peripheral alias given in platform.c file of your platform.

The struct platform_pwm_peripherals[] contains configurations for different aliases provided by WICED. You can use the GPIOs mentioned in the struct as PWMs.

1 of 1 people found this helpfulSee the answer in context

 

  •  
  •   

 

THIS WAS THE STUCTURE OUTLINED Below,    please note that the SPI structure is also using the same GPIO's:

/* PWM peripherals. Used by WICED/platform/MCU/wiced_platform_common.c */

const platform_pwm_t platform_pwm_peripherals[] =

{

    [WICED_PWM_1]  = {TIM3,  3, RCC_APB1Periph_TIM3,  GPIO_AF_TIM3,  &platform_gpio_pins[WICED_GPIO_11]},

    [WICED_PWM_2]  = {TIM10, 1, RCC_APB2Periph_TIM10, GPIO_AF_TIM10, &platform_gpio_pins[WICED_GPIO_26]},

    [WICED_PWM_3]  = {TIM2,  2, RCC_APB1Periph_TIM2,  GPIO_AF_TIM2,  &platform_gpio_pins[WICED_GPIO_2] }, /* or TIM5/Ch2                       */

    [WICED_PWM_4]  = {TIM2,  3, RCC_APB1Periph_TIM2,  GPIO_AF_TIM2,  &platform_gpio_pins[WICED_GPIO_3] }, /* or TIM5/Ch3, TIM9/Ch1             */

    [WICED_PWM_5]  = {TIM2,  4, RCC_APB1Periph_TIM2,  GPIO_AF_TIM2,  &platform_gpio_pins[WICED_GPIO_4] }, /* or TIM5/Ch4, TIM9/Ch2             */

    [WICED_PWM_6]  = {TIM2,  1, RCC_APB1Periph_TIM2,  GPIO_AF_TIM2,  &platform_gpio_pins[WICED_GPIO_6] }, /* or TIM2_CH1_ETR, TIM8/Ch1N        */

    [WICED_PWM_7]  = {TIM3,  1, RCC_APB1Periph_TIM3,  GPIO_AF_TIM3,  &platform_gpio_pins[WICED_GPIO_7] }, /* or TIM1_BKIN, TIM8_BKIN, TIM13/Ch1*/

    [WICED_PWM_8]  = {TIM3,  2, RCC_APB1Periph_TIM3,  GPIO_AF_TIM3,  &platform_gpio_pins[WICED_GPIO_8] }, /* or TIM8/Ch1N, TIM14/Ch1           */

    [WICED_PWM_9]  = {TIM5,  2, RCC_APB1Periph_TIM5,  GPIO_AF_TIM5,  &platform_gpio_pins[WICED_GPIO_2] }, /* or TIM2/Ch2                       */

};

/* PWM peripherals. Used by WICED/platform/MCU/wiced_platform_common.c */

const platform_spi_t platform_spi_peripherals[] =

{

    [WICED_SPI_1]  =

    {

        .port                  = SPI1,

        .gpio_af               = GPIO_AF_SPI1,

        .peripheral_clock_reg  = RCC_APB2Periph_SPI1,

        .peripheral_clock_func = RCC_APB2PeriphClockCmd,

        .pin_mosi              = &platform_gpio_pins[WICED_GPIO_8],

        .pin_miso              = &platform_gpio_pins[WICED_GPIO_7],

        .pin_clock             = &platform_gpio_pins[WICED_GPIO_6],

        .tx_dma =

        {

            .controller        = DMA2,

            .stream            = DMA2_Stream5,

            .channel           = DMA_Channel_3,

            .irq_vector        = DMA2_Stream5_IRQn,

            .complete_flags    = DMA_HISR_TCIF5,

            .error_flags       = ( DMA_HISR_TEIF5 | DMA_HISR_FEIF5 | DMA_HISR_DMEIF5 ),

        },

        .rx_dma =

        {

            .controller        = DMA2,

            .stream            = DMA2_Stream0,

            .channel           = DMA_Channel_3,

            .irq_vector        = DMA2_Stream0_IRQn,

            .complete_flags    = DMA_LISR_TCIF0,

            .error_flags       = ( DMA_LISR_TEIF0 | DMA_LISR_FEIF0 | DMA_LISR_DMEIF0 ),

        },

    }

};

0 Likes
6 Replies
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

The pins are used for SPI_1 when the board is initialized. Where are the pwm pins initialized in your program? Are you initializing the pwm pins soon after wiced_init() or in wiced_init()?

If you have used STM cube, can you please check if you are seeing the same behaviour by programming using STM cube?

0 Likes

PriyaM_16,   we are putting it as follows

#include "wiced.h"

#define PWM_motor1 WICED_PWM_1    // Red Pin 21

#define PWM_motor2 WICED_PWM_2    // Blue Pin 24

#define PWM_motor3 WICED_PWM_7   // Green Pin 19

#define PWM_motor4 WICED_PWM_8   // White Pin 22

void application_start()

{ /* start of program  */

WPRINT_APP_INFO((" test1\n"));

wiced_init();   /* Initialize the WICED device */

WPRINT_APP_INFO((" test2\n"));

wiced_gpio_deinit(WICED_LED2);

wiced_gpio_deinit(WICED_LED1);

wiced_gpio_deinit(PWM_motor1);

wiced_gpio_deinit(PWM_motor2);

wiced_gpio_deinit(PWM_motor3);

wiced_gpio_deinit(PWM_motor4);

so everything is used after application start.   What did you mean by STM cube ??  have not seen this in the documentation.   we are using wiced studio 6.2, for this compile.

0 Likes

The application is stored in external flash if your platform makefile contains RESOURCES_LOCATION ?= RESOURCES_IN_WICEDFS.. I am using the BCM94343WWCD2 platform and the platorm makefile is /43xxx_Wi-Fi/platforms/BCM94343WWCD2/BCM94343WWCD2.mk.

Kindly change the location to

RESOURCES_LOCATION ?= RESOURCES_IN_DIRECT_RESOURCES

to store your application and filesystem in internal flash.

Also comment out the #define WICED_PLATFORM_INCLUDES_SPI_FLASH in the platform.h file. Commenting out this line will not init the external flash. Hence the pins multiplexed with SPI will not be used.

In your application, kindly init the pwm pins soon after wiced_init() and check the output at the pin. I have tested the WICED_PWM_7 as follows:

if(wiced_pwm_init(WICED_PWM_7, 2000, 50 ) != WICED_SUCCESS){

  WPRINT_APP_INFO( ( "Error in init PWM ....\n" ) );

  }

  if(wiced_pwm_start(WICED_PWM_7) != WICED_SUCCESS){

  WPRINT_APP_INFO( ( "Error in starting PWM ....\n" ) );

  }

Please test your setup with the following changes and let me your findings.

Regards,

Priya

0 Likes

PriyaM_16

as it stands now this does not work correctly changed   .h and .mk files with your changes the build hangs at the WICED_init I am attaching the screen shot:

pastedImage_2.png

This stops at this point of the build.

let me know what you recommend.

Sincerely,
Gillian.

0 Likes

Can you please start a debug session and see the reason for this behaviour? It appears that the wifi firmware is not loaded into intenal flash.

0 Likes

PriyaM_16    

Do you have the debug function lines to initialize this and to add to the code.  I have not used the cypress debug function as of yet.

Will see if i can get this setup in the mean time and get you some results.


SIncerely,

Gman

0 Likes