3430 views|11 replies

108

Posts

0

Resources
The OP
 

(Bonus 10) GD32L233 Review - SPI Driver DS1302 [Copy link]

 
This post is from GD32 MCU

Latest reply

This logic is correct. I guess your screenshot was taken without waiting. I solved it this way. There must be something wrong with the SPI hardware logic of GD32.   Details Published on 2022-3-7 22:44
 

6587

Posts

0

Resources
2
 

The SPI driver DS1302 is introduced in detail, praise

The long sharp pulses along the rising and falling edges of CLK in the SPI waveform of the final test result are normal, right?

This post is from GD32 MCU

Comments

It's normal, there is no peripheral, it comes directly from Dupont line  Details Published on 2022-2-11 09:00
 
 
 

108

Posts

0

Resources
3
 
Jacktang posted on 2022-2-11 07:32 The introduction of SPI driver DS1302 is very detailed. I like it. The long sharp pulses on the rising and falling edges of CLK in the SPI waveform of the final test result are normal, right?

It's normal, there is no peripheral, it comes directly from Dupont line

This post is from GD32 MCU
 
 
 

108

Posts

0

Resources
4
 
 

1305

Posts

0

Resources
5
 

The GPIO firmware in the GD32L223 official software support package does not have the following two functions!

gpio_init_af_mode(); gpio_init_output_mode();

Are you sure you are using GD32L223?

This post is from GD32 MCU

Comments

These two are encapsulated by me, which is the initialization of io  Details Published on 2022-3-1 08:55
 
 
 

108

Posts

0

Resources
6
 
yang_alex posted on 2022-2-28 22:39 The GPIO firmware in the GD32L223 official software support package does not have the following two functions! gpio_init_af_mode(); ...

These two are encapsulated by me, which is the initialization of io

This post is from GD32 MCU
 
 
 

1305

Posts

0

Resources
7
 

Why not use it directly? The original one is not easy to use. You need to set several PINs at a time. I guess you set one PIN at a time. Can you send it to me? I think there is something wrong with the SPI peripheral driver code of GD32. I also have a SPI read-only peripheral. I spent 2 days to recalculate it, but I set it to SPI_TRANSMODE_FULLDUPLEX duplex mode. Read-only mode doesn't work at all.

This post is from GD32 MCU

Comments

Actually, there is nothing special about it. It is just easier to use after encapsulation. void gpio_init_af_mode(rcu_periph_enum rcu, uint32_t gpio, uint32_t pin, uint32_t speed, uint32_t af_func) { rcu_periph_clock_enable(rcu);  Details Published on 2022-3-7 10:36
 
 
 

1305

Posts

0

Resources
8
 

I feel your last picture is also weird. Is CE the chip select signal? How come the CE state changes, the clock signal is still running, and the data can still be read out?

This post is from GD32 MCU

Comments

Normal. If the chip performance is normal, there is a waiting time. data = spi_i2s_data_receive(CURRENT_SPI); while(spi_i2s_flag_get(CURRENT_SPI, SPI_FLAG_TRANS));  Details Published on 2022-3-7 10:48
 
 
 

108

Posts

0

Resources
9
 
This post was last edited by Yunhu Congbai on 2022-3-7 10:38
yang_alex posted on 2022-3-1 17:20Why not use it directly? The original one is not easy to use. You need to set several PINs at a time. I guess you set one PIN at a time. Can you post it to see? It feels...

Sorry, I was on a business trip to Shenzhen for 2 weeks and just came back.

Actually, there is nothing special about it. It is just easier to use after encapsulation.

void gpio_init_af_mode(rcu_periph_enum rcu, uint32_t gpio, uint32_t pin, uint32_t speed, uint32_t af_func)
{
    rcu_periph_clock_enable(rcu);
    gpio_mode_set(gpio, GPIO_MODE_AF, GPIO_PUPD_NONE, pin);
    gpio_output_options_set(gpio, GPIO_OTYPE_PP, speed, pin);
    gpio_af_set(gpio, af_func, pin);
}

void gpio_init_input_mode(rcu_periph_enum rcu, uint32_t gpio, uint32_t pin)
{
    rcu_periph_clock_enable(rcu);
    gpio_mode_set(gpio, GPIO_MODE_INPUT, GPIO_PUPD_NONE, pin);
}

void gpio_init_output_mode(rcu_periph_enum rcu, uint32_t gpio, uint32_t pin, uint32_t speed, uint8_t set)
{
    rcu_periph_clock_enable(rcu);
    gpio_mode_set(gpio, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, pin);
    gpio_output_options_set(gpio, GPIO_OTYPE_PP, speed, pin);
    if (set)
    {
        gpio_bit_set(gpio, pin);
    }
    else
    {
        gpio_bit_reset(gpio, pin);
    }
}

This post is from GD32 MCU
 
 
 

108

Posts

0

Resources
10
 
This post was last edited by Yunhu Congbai on 2022-3-7 10:49
yang_alex posted on 2022-3-1 17:23 I feel that your last picture is also weird. Is CE a chip select signal? How come the CE state changes, the clock signal is still running, and the data can still be read out?

That's normal.

If the chip performance is average, there will be a period of waiting before it ends.

That’s how I understand it.

I looked at the graph I saved when I tested stm32 F103 before, and there it is.

data = spi_i2s_data_receive(CURRENT_SPI);

while(spi_i2s_flag_get(CURRENT_SPI, SPI_FLAG_TRANS));

This post is from GD32 MCU

Comments

This logic is correct. I guess your screenshot was taken without waiting. I solved it this way. There must be something wrong with the SPI hardware logic of GD32.  Details Published on 2022-3-7 22:44
 
 
 

1305

Posts

0

Resources
11
 
Yunhu Congbai posted on 2022-3-7 10:48 yang_alex posted on 2022-3-1 17:23 I think your last picture is also weird. Is CE a chip select signal? Why did the CE state change, the clock signal...

This logic is correct. I guess your screenshot was taken without waiting. I solved it this way. There must be something wrong with the SPI hardware logic of GD32.

This post is from GD32 MCU

Comments

NO, the waiting sequence is necessary, I have always had it. If there is no waiting sequence, it will be wrong. My understanding is that the MCU with lower performance may have a longer waiting time, so another clock was introduced later.  Details Published on 2022-3-8 08:36
 
 
 

108

Posts

0

Resources
12
 
yang_alex posted on 2022-3-7 22:44 This logic is correct. I guess your picture was taken without waiting. I solved it this way. There should be something wrong with the SPI hardware logic of GD32. ...

NO, waiting for timing is necessary, I always have it.

If there is no waiting time, something goes wrong.

My understanding is that a microcontroller with lower performance may have to wait longer, so a clock was introduced later.

This post is from GD32 MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>
Featured Posts
Children's humor

Mom called Pippi to get up: " Hurry up and get up! The rooster has crowed several times! " Pippi said: " What does the r ...

Semiconductor Supplier Competition Focus: Next Generation IP Business

The widespread deployment of broadband networks and the popularity of VoIP applications complement each other. In additi ...

Start → Run → Command Encyclopedia

This post was last edited by jameswangsynnex on 2015-3-3 20:00 winver---------Check the Windows version wmimgmt.msc--- ...

Home electronics teaches you a trick

1. The magnesium rod of the electric water heater should be replaced frequently. The inner tank of the electric water h ...

【AT32F421 Review】+ CoreMark score

In the previous evaluation , we have set up the environment required for development, created a new project from scratch ...

[Flower carving hands-on] Interesting and fun music visualization series of small projects (25) - water tornado vortex lamp

I had the urge to do a series of topics on sound visualization. This topic is a bit difficult and covers a wide range of ...

I would like to ask about the random way, that is, writing the last 64 bytes of 24C256 by byte and writing its last 64 bytes by page.

How does the 24C256 know whether the program requires it to be written in pages or in bytes when the last 64 bytes of th ...

In-depth analysis of key technologies and MCU solutions for automotive zone controllers

This post was last edited by Hot Ximixiu on 2024-3-22 07:25 The regional controller is a node in the car. It provides ...

Longan Pi 3H Development Board (Basic Introduction)

This post was last edited by wuboy on 2024-4-8 09:49 # Longan Pi 3H Development Board## Unboxing contents Open the packa ...

"Rust in Action" Book Club Interaction Episode 5: In-depth Understanding of Data

Starting from the fifth episode, we enter the second part of "Rust in Action": Unveiling the mystery of system programmi ...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list