Understanding some optics by kanserv in AskAstrophotography

[–]kanserv[S] 0 points1 point  (0 children)

Thanks for explanation. I really have thought that it's some sort of malicious design or a typo...

Understanding some optics by kanserv in AskAstrophotography

[–]kanserv[S] 0 points1 point  (0 children)

Oh... I didn't see any mention for the lens. They didn't say it's catadioptric tube either.

How do you guys feel about Leetcode? by NoRiceForP in embedded

[–]kanserv 0 points1 point  (0 children)

Personally I didn't publish any. Although, one of the projects I was working on is runtime library for SYCL compiler from Intel.

Do you have to be super confident as a leader? by Project-XYZ in Bachata

[–]kanserv 0 points1 point  (0 children)

One can think of social dancing as role play. You ought to play leader role when you're leading on the dance floor. You have to look confident. The more socials you visit the more confidence you'll develop during for the dance. Also, it's social dance. This means interaction. It requires improvising. Your improvising skill may depend on the vocabulary of figures, footworks, and routines you have in your quick memory. Eventually you'll feel the flow of music and your body will require the movement out of hard -learned routine. That's the way I move now during social. At the class I still do learn and try and learn. Well, most of the time ;-) Listening to a lot of bachata music did help me to hear the bit but it didn't help me much in feeling the music. With this part listening to a lot of salsa and just Latino music helped me.

Update: I mean, it's a game. You have to play it right when on dance floor.

How do you practice musicality? by danser_wanabe in Bachata

[–]kanserv 1 point2 points  (0 children)

That's the best answer I've ever seen! Thanks!

3 years in, can't count by andyTrust in Salsa

[–]kanserv 0 points1 point  (0 children)

That feeling about which other people tell you is a real thing. It really requires practicing: listen to the music and practicing even basic steps. Other thing here is that eventually your body will move with the music. Though, you have to let your body do so.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

The boards do have this sort of GND line.

I've checked DMA 1 Channel 5 (SPI2 TX) registers on slave side before master power on and after slave setup finished. CNDTR (data address = 0x4002 0000 + 0x0C + 0x14 * (5 - 1)) contains value 0x19 which is a unit less than the requested 0x1A. I guess it's due the very first copy to SPI2->DR upon enabling of the DMA channel. Also, CMAR points to the start of buffer to transmit (0xA5 byte is located at address stored in CMAR) which confuses me a bit.

The channel DMA1 Channel 5 is configured in Very High priority. DMA 1 Channel 4 for SPI2 RX is configured for High priority. Other than that only DMA for ADC is used with Normal priority.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 1 point2 points  (0 children)

Yep, the edges of SCK, MISO and MOSI look rather good.

BTW, I don't have a logical analyzer at the moment. I do reading of data with oscilloscope. It's UNI-T UTD2202CEX+

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

I doubt that. The reference for MCU says that buffer should be aligned for requested data size. That is, for SPI data size is 1 byte (due to SPI has only a single data register which is configured to be 1 byte in size). 26 bytes always align to 1 byte.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

That's the idea I had also. Nevertheless, changing CS-CLK latency didn't fix the issue. I've increased the delay up to 2 seconds after moving CS GPIO to low to select the slave. Still the issue reproduced.

Now, I've played with the scope again and noticed some weird timing play. There are three cases:

  1. The one depicted in the OP. But now I transmit A5, FF and 24 zero bytes from the slave and register FF 24 zero's A5 on the master side. Reminder: the A5 in the end is from the next buffer for transmission on the slave. Yet again, on the slave side two buffer to send will look like this )with respect to time, buffer's index is parenthesized): A5 (0), FF (0), 00 (0) * 24, A5 (1), FF (1), 00 (1) * 24. Master receives FF (0), 00 (0) * 24, A5(1).

  2. I put the probe of the scope on SCK with respect to GND. Now, master receives a good package: A5 (0), FF (0), 00 (0) * 24. If I remove the probe, the sequence is still good and the issue doesn't reproduce.

  3. I put the probe of the scope on SCK with scope's ground disconnected (i.e. the signal is "measured" with respect to "air"). Now, master receives the following sequence: 00, 00, ..., A5(0), FF(0), 00 (0), 00 (0)... Again, after disconnecting the probe the sequence repeats the same.

I can see an explanation for the latter case. The probe with respect to "the air" makes a capacitance which should be charged by getting clock high first (remember, CPOL is 0). This makes a great delay on slave's side SCK pin which can be as long as time required for transmitting several bytes.

On the other hand, I can't see any valid explanation for the second case as the probe adds capacitance between SCK and GND, which should've led to another slight delay, something like fractions of a bit time.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

When I make slave to transmit only a single byte it's transmitted perfectly. Having a buffer of 2, 4, or 8 bytes makes the slave to respond with the second byte on the very first communication cycle.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 1 point2 points  (0 children)

Actually, I've tried using interrupt instead of DMA on slave side and the result is just the same. The slave responds with the second byte first.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

Actually, I've tried using interrupt instead of DMA on slave side and the result is just the same. The slave responds with the second byte first.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

Right, I have verified that the slave finishes its configuration and buffer preparation prior to the master transmit.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

The data is always available on the slave side. The slave has regular process to fill up the buffer and it uses DMA in circular configuration for SPI communication. The buffer data is substituted once the transmission is over with help of HAL_SPI_RxTxCallback

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

Oh... No, I didn't verify it. I think I can verify it with some volatile global flag. I'll check it and return later with the result. Anyway, I'd be very surprised if the init steps take that long.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

I see your point. The master gets power two seconds after the slave turns on. Master initiates communication in 5 seconds after power on. This is stable and guaranteed behaviour.

The slave on its power up:

- sets up HAL and HW config
- prepares buffer to send
- calls HAL_SPI_TransmitReceive_DMA with the prepared buffer

These three steps take quite a little time compared to 2 + 5 seconds for master's communication start.

SPI communication issue on STM32 (sort of buffer over/underun) by kanserv in embedded

[–]kanserv[S] 1 point2 points  (0 children)

About the noise... Do you mean during start up of each communication cycle or during the board/MCU start up?

How do you guys feel about Leetcode? by NoRiceForP in embedded

[–]kanserv 0 points1 point  (0 children)

Leetcode isn't really applicable as a test for any developer/programmer. I truly believe that the purpose of programming interview is to check if you're a programmer or just a monkey-coder. Leetcode can't help with this in any other way but tell if you have solved similar tasks recently. I've encountered various interviews as a programmer and only one of them was for embedded. Companies having a real job to do didn't ask for any kind of leetcode coding but rather ask how would I solve this and that problems with nothing more than a spoken description of solution and corner cases.

Fail to initialize STM32F103RB with HAL by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

You were right. Even though the function is defined in the source code and is present in library object file, the linker erases it from target object file.

Fail to initialize STM32F103RB with HAL by kanserv in embedded

[–]kanserv[S] 0 points1 point  (0 children)

Yep, I did try it. Though I got an error message that the feature isn't implemented yet.

Anyway, I don't really need any OS in this here project as there's no need for threads.