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

cross mob
kmantem
Level 1
Level 1
5 replies posted 10 questions asked 25 sign-ins

Hi

We recently started to play with the CYW20829 chip and are considering migrating a hardware application we originally built on the CYW20719B2 chip to it.

In porting code for a SPI NAND Memory chip over to the new 20829, we are having trouble mapping the WICED APIS to the CY_HAL API's and getting them to work.

We are not getting any errors from init, are using the default PINS on device configurator for the 20829, but we are getting fails on reading and writing using  cy_hal_spi_slave_read, and cy_hal_spi_slave_write. 

Here is a snippet from the 20719B2 Code that sets up the device and our attempt to migrate the equivalent code to 20829

Our code drives the CS pin High and Low before doing Read/Writes w/o issue on the 20719, but not sure we have the correct method figured out on the 20829

 

20719 INIT Code

wiced_hal_gpio_select_function(NAND_CS_PIN, WICED_GPIO);
wiced_hal_gpio_select_function(NAND_SCK_PIN, WICED_SPI_1_CLK);
wiced_hal_gpio_select_function(NAND_MOSI_PIN, WICED_SPI_1_MOSI);
wiced_hal_gpio_select_function(NAND_MISO_PIN, WICED_SPI_1_MISO);
wiced_hal_gpio_configure_pin(NAND_CS_PIN, GPIO_OUTPUT_ENABLE | GPIO_PULL_UP, GPIO_PIN_OUTPUT_HIGH);

wiced_hal_pspi_init(SPI1,FS_NAND_HW_SPI_CLK_FREQ / 2,SPI_MSB_FIRST,SPI_SS_ACTIVE_LOW,SPI_MODE_3);

 

 

20829 INIT Code

  memset(&mSPI, 0, sizeof(mSPI));
  printf("_HW_Init");
  result = cyhal_spi_init(&mSPI,CYBSP_SPI_MOSI,CYBSP_SPI_MISO,CYBSP_SPI_CLK,
                              CYBSP_SPI_CS,NULL,8,
  CYHAL_SPI_MODE_11_MSB,false);
  if (result != CY_RSLT_SUCCESS) {
          printf("Fail");
  CY_ASSERT(0);
  }
 
  //cyhal_gpio_init(CYBSP_SPI_CS, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, true);
  result = cyhal_spi_set_frequency(&mSPI, FS_NAND_HW_SPI_CLK_FREQ / 2);
  if (result != CY_RSLT_SUCCESS) {
          printf("Fail");
  CY_ASSERT(0);
  }
  result = cyhal_spi_select_active_ssel(&mSPI,CYBSP_SPI_CS);
  if (result != CY_RSLT_SUCCESS) {
          printf("Fail");
  CY_ASSERT(0);
  }
  result = cyhal_spi_slave_select_config(&mSPI,CYBSP_SPI_CS,CYHAL_SPI_SSEL_ACTIVE_HIGH);
  if (result != CY_RSLT_SUCCESS) {
            printf("Fail");
    CY_ASSERT(0);
    }

 

20719 Drive CS Up or Down

wiced_hal_gpio_set_pin_output(NAND_CS_PIN, GPIO_PIN_OUTPUT_LOW);

wiced_hal_gpio_set_pin_output(NAND_CS_PIN, GPIO_PIN_OUTPUT_HIGH);

 

20829 Drive CS Up or Down

We have tried both of these:
cyhal_gpio_toggle(CYBSP_SPI_CS);

or

cyhal_spi_slave_select_config(&mSPI,CYBSP_SPI_CS,CYHAL_SPI_SSEL_ACTIVE_LOW);

cyhal_spi_slave_select_config(&mSPI,CYBSP_SPI_CS,CYHAL_SPI_SSEL_ACTIVE_HIGH);

Our Read/Write Looks like this

20719

wiced_hal_pspi_rx_data(SPI1, NumBytes, pData);

wiced_hal_pspi_tx_data(SPI1, NumBytes, pData);

20829

cyhal_spi_slave_read(&mSPI,pData,&size,10);

cyhal_spi_slave_write(&mSPI,pData,&size,10);

 

Any help would be appreciated !!

 

 

0 Likes
13 Replies
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem ,

Thanks for your interest in our 20829! 🙂

For the SPI operation, have you tried

cyhal_spi_transfer( cyhal_spi_t * obj,
                    const uint8_t * tx,
                    size_t tx_length,
                    uint8_t * rx,
                    size_t rx_length,
                    uint8_t write_fill );

?

This is example usage (from API doc) on that function :

/* The following snippet sends and receives an array of data in a single 
* SPI transaction using cyhal_spi_transfer(). The example uses SPI master 
* to transmit 5 bytes of data and receive 5 bytes of data in a single 
* transaction. 
*/
    cy_rslt_t   rslt;
    cyhal_spi_t mSPI;
    uint32_t    spi_frequency    = 1000000;
    uint8_t     transmit_data[5] = { 0x1, 0x2, 0x3, 0x4, 0x5 };
    uint8_t     receive_data[5];
 
    // BSP-1637 workaround
    memset(&mSPI, 0, sizeof(mSPI));
 
    // Configuring the  SPI interface:  Specify the SPI interface pins, frame size, SPI Motorola
    // mode and master/slave mode
    rslt = cyhal_spi_init(&mSPI, CYBSP_SPI_MOSI, CYBSP_SPI_MISO, CYBSP_SPI_CLK, CYBSP_SPI_CS, NULL,
                          8, CYHAL_SPI_MODE_00_MSB, false);
 
    // Set the data rate to 1 Mbps
    rslt = cyhal_spi_set_frequency(&mSPI, spi_frequency);
 
    // Master: Starts a data transfer. Slave: Prepares the slave for data transfer. It is a blocking
    // function
    if (CY_RSLT_SUCCESS == cyhal_spi_transfer(&mSPI, transmit_data, 5u, receive_data, 5u, 0xFF))
    {
        // Transfer Complete
    }

I look forward to hearing back from you.

Thank you and regards,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem,

May you kindly update your status on this issue ?
I will lock this discussion thread if you already ok with this.

Thank you and regards,
Muhammad Nanda

0 Likes

We have not had success as of yet.

We see that the Arduino headers for SPI are disabled by default and the base board needs rework when we dug into the documents. So we are waiting for that to be completed.

Also we don't see any way to externally connect to the QSPI  (P2.X ) which our chip also supports. Are their headers/pins we can attach an external chip to to reach QSPI?

Its a bit disappointing that the eval board comes with the bus disabled and that it requires us to desolder jumpers and move them to new positions.  

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem,

For the SPI, 4 pins in CYW920829M2EVK-02 can go out in Arduino headers as follow:

  1. P1.1 (Arduino D13): CLK
  2. P1.3 (Arduino D12): MISO
  3. P1.2 (Arduino D11): MOSI
  4. P1.0 (Arduino D10): CS

For the QSPI, yes I am still make internal discussion on P2.0 - P2.5.

I am sorry for any inconvenience. 

Thank you and regards,
Muhammad Nanda 

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem,

For the QSPI, may you confirm if you already populating those pins (in U14) :

MuhammadNanda_K_1-1712562353788.png

 

by following the user guide section 5.2 ? 

Then do you want to use headers/socket instead of soldering the flash chip directly on the board ?

BR,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem,

After further discuss, we can also suggest if you only wanted to try QSPI without hardware modification, you may try on-board memory at radio card PCB (red PCB / the M.2 board) using ModusToolbox (MTB) project example "Serial Flash Read Write". Below is picture of memory chip in U2.

MuhammadNanda_K_0-1712850328339.png

If you wanted to use U14 instead, you may consider as my previous post.
These are resistors for reworks to use U14 on base board:

MuhammadNanda_K_1-1712850433231.png

I look forward to hearing back from you.

Thank you and regards,
Muhammad Nanda

0 Likes
kmantem
Level 1
Level 1
5 replies posted 10 questions asked 25 sign-ins

Muhammad,


Thanks for your help.

We received our reworked board to try the SPI Interface, and ran into a different issue.  It appears that the SPI Pins share a path with the SWDCLK and SWDIO which are needed by Kitprog3 to program the chip. So while it looks like we now have a board with SPI resistors set correctly, we getting errors from Kitprog saying it can't reach the chip to program it.

Is there a workaround?  Or do we need 2 kits, one to program with and one to use the SPI interface?

A future suggestion is to put dip switches on these lines versus requiring rework as this is seemingly difficult.

I will look at the QSPI some more, but the U14 pad is empty and has no way for me to add a removable pin chip. 

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem,

My apologize for the delay.
I am sorry that, at this point we wanted to clarify:

  1. The "reworked board" is that the CYW920829M2EVK-02 with rework in soldered resistor(s) ?
  2. Which NAND chip do you wanted to use (which part number / product) ?
  3. For the QSPI in U14, surely that is empty when CYW920829M2EVK-02 shipped. You may choose any chip using QSPI that compatible with the pins (on PCB baseboard).

I look forward to hearing back from you.

Thank you and regards,
Muhammad Nanda

0 Likes
kmantem
Level 1
Level 1
5 replies posted 10 questions asked 25 sign-ins

Muhammad, 

Yes that is the development kit we are using  the CYW920829M2EVK-2 -   to enable the SPI we moved the 4 resistors on base board per the user guide.

We are trying to use the Micron NAND --   MT29F8G01ADBFD12-AAT:F TR   --  with the chip.  We have previously used this chip with the 20719B2 chip without issue, but are struggling to get this to work with the 20829 chip , even after the rework -- 

 

0 Likes
ADSW
Moderator
Moderator
Moderator
250 sign-ins 50 solutions authored 25 likes received

Hello @kmantem , 

Yes that is the development kit we are using  the CYW920829M2EVK-2 -   to enable the SPI we moved the 4 resistors on base board per the user guide.
- Which resistors do you mean ? and which board ?

Refer to the schematic of the kits, there is 2 board: CYW9BTM2BASE3 and CYW920829M2IPA2.
There is Nor-flash GD25WQ80EEFG connected to the CYW20829 by default on the CYW920829M2IPA2 board and there is no connection from QSPI-pin ( P2.0 - P2.5 ) of CYW20829 to the CYW920829M2IPA2 board.
ADSW_0-1714015074223.png

if you want to use another flash memory, you need to re-work the CYW920829M2IPA2 board first.
By change the connection of the R14, R15, R16, R17, R18, and R19 from C-A to C-B. So the pin of CYW20829 ( P2.0 - P2.5 ) will connect to the board CYW920829M2IPA2 ( rsvd pin ). 

Then you can place your QSPI-flash chip on U14 pad of CYW9BTM2BASE3 board, and you need several resistor to make a connection between the QSPI line of CYW920829M2IPA2 board and that flash memory as shown in the following image ( as reference ).

ADSW_1-1714017946316.png

Thanks & regards
Andri




 





0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem,

Do you still have any concern after explanations from us ?

If you still have issue, please kindly inform. 🙂

Best regards,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem ,

May you kindly update your status on this issue ?

Best regards,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
50 solutions authored 250 sign-ins 250 replies posted

Hello @kmantem ,

If you still have any concern on the issue, please kindly inform your current status.

I will lock this discussion thread on another day if no more discussion on this.

Best regards,
Muhammad Nanda

0 Likes