Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with w2q16jv interface #16

Open
Rajkumar181 opened this issue Jun 19, 2020 · 8 comments
Open

Error with w2q16jv interface #16

Rajkumar181 opened this issue Jun 19, 2020 · 8 comments

Comments

@Rajkumar181
Copy link

Hi,
Thank you for your support.
I am using STM32L432KC with W2q16jV. But I am not able to read the device ID. Please can you look it my code, I don't know where I am doing the mistake?

static void MX_SPI1_Init(void)
{

/* USER CODE BEGIN SPI1_Init 0 */

/* USER CODE END SPI1_Init 0 */

/* USER CODE BEGIN SPI1_Init 1 */

/* USER CODE END SPI1_Init 1 /
/
SPI1 parameter configuration*/
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 7;
hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN SPI1_Init 2 */

/* USER CODE END SPI1_Init 2 */

}

In main

W25qxx_Init();

Output:
w25qxx Init Begin...
w25qxx ID:0xFFFFFF
w25qxx Unknown ID

@nimaltd
Copy link
Owner

nimaltd commented Jun 19, 2020

Hello. Do you config correctly w25qxxconfig.h file? And cs pin.

@Rajkumar181
Copy link
Author

Yes, and I have checked the cs pin and clock pin.

@nimaltd
Copy link
Owner

nimaltd commented Jun 20, 2020

Your cs must be set in software mode

@Rajkumar181
Copy link
Author

GPIO_InitStruct.Pin = SPI_SEL1_Pin|SPI_SEL2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

yes, it is software mode.

@nimaltd
Copy link
Owner

nimaltd commented Jun 22, 2020

Send photo of your spi config in cubemx

@Rajkumar181
Copy link
Author

image
image
image

@nimaltd
Copy link
Owner

nimaltd commented Jun 23, 2020

Disable interrupt and dma and try again

@Rajkumar181
Copy link
Author

Hi,
Sorry for the late reply, i have tried to disable the DMA and interpret, still i am getting same Error.

image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants