2021-06-02 03:01 AM
My purpose is to send an "HELLO" using a NUCLEO-L4R5ZI-P board trough HYPERBUS.
On the STM32CubeIDE, I configurated OCTOSPI1 peripherial and I/O associated.
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "octospi.h"
#include "gpio.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
OSPI_HyperbusCmdTypeDef scommand;
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
uint8_t buffer[] = "HELLO";
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
HAL_OSPI_MspInit(&hospi1);
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_OCTOSPI1_Init();
/* USER CODE BEGIN 2 */
scommand.AddressSpace = HAL_OSPI_MEMORY_ADDRESS_SPACE ;
scommand.AddressSize = HAL_OSPI_ADDRESS_16_BITS;
scommand.DQSMode = HAL_OSPI_DQS_ENABLE;
scommand.Address = OCTOSPI1_BASE + 5;
scommand.NbData = 5;
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_OSPI_HyperbusCmd(&hospi1,&scommand,HAL_OSPI_TIMEOUT_DEFAULT_VALUE);
HAL_OSPI_Transmit(&hospi1,buffer,HAL_OSPI_TIMEOUT_DEFAULT_VALUE);
HAL_Delay(1);
//uint8_t* mem_addr = ( uint8_t * )( OCTOSPI1_BASE + 0 );
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
But when I'm debugging this program with a logic analyser I have frame that doesn't look like an Hyperbus frame.
I have 2 bytes sent then a long gap before the 3 next bytes are sent.
Also the data strobe rise on last byte sent when it should rise on each data.
How can I solve this?