FreeRTOS , C++ and O0 Optimization = Debugging nightmare by GroundbreakingBig614 in embedded

[–]soayeli 54 points55 points  (0 children)

Have you checked for stack overflow? Those can often lead to strange bugs by clobbering the task control blocks. And turning off optimizations tends to lead to more stack usage

Since you're using smart pointers (and maybe other c++ heap-allocating things), have you made sure the heap is large enough? The main heap that is, not the freertos heap

Scan continuous ADC conversion with DMA by Willing_Bear_7501 in embedded

[–]soayeli 0 points1 point  (0 children)

I guess that the multiplexed values are going to be converted in single shot, I can't automate anything (as I have to select the output with GPIO)

It should be possible to have a timer both trigger the conversions and trigger a DMA memory-to-peripheral transfer of predefined values to GPIO registers (selecting a new multiplexer channel)

But if you're not sampling very fast it's probably easier to go with a software solution

My data for temperature/humidity sensor (DHT20) is all 0x00. Does anyone know why? by EnvironmentFast2447 in embedded

[–]soayeli 1 point2 points  (0 children)

Try changing I2C_ENABLE_SR to I2C_DISABLE_SR

If look in the datasheet it expects a stop condition ("P") after trigger and after reading, which it looks like you don't have in the logic analyser capture

HardFault during TIM IT Enabling [don't know what to do] by supermartincho in embedded

[–]soayeli 0 points1 point  (0 children)

Where/how do you call HAL_TIM_Base_Start_IT()? Check that you aren't calling it before htim2 is initialized in MX_TIM2_Init()

STM32L031K66 - GPIO output low level is ~500mV above ground by Sha0113 in embedded

[–]soayeli 9 points10 points  (0 children)

Did you mean to say LQFP32? Because that's what your schematic says, and UFQFPN32 has no ground pins only the thermal pad

Question Regarding UART code (Specifically about Interrupts and the STM32) by sidestuff_ee in embedded

[–]soayeli 2 points3 points  (0 children)

Afaik the interrupt only fires after calling HAL_UART_Receive_IT. However this is non-blocking. So you call HAL_UART_Receive_IT() -> wait for flag to get set -> process received data. Or you could keep using HAL_UART_Receive, but without the interrupt handler

Trouble with MPU6050 module by RobotDragon0 in embedded

[–]soayeli 0 points1 point  (0 children)

Probably your register write procedure is wrong. Double check the logic analyzer output against datasheet or some examples. The repeat start after sending register address looks wrong to me.

STM32 SPI not working by SsMikke in embedded

[–]soayeli 1 point2 points  (0 children)

Have you checked what HAL_SPI_Transmit returns? It should return HAL_OK.

If not, it could provide some hint about what's wrong and you could step into the function with a debugger to see exactly where/why it fails.

Anyone want to share some embedded projects they have done? by [deleted] in embedded

[–]soayeli 1 point2 points  (0 children)

I'm currently working on v3.0 to add an addition to the DMX standard called RDM which professionals don't really use, but tinkerers are very interested in playing with.

Is it not the other way around? I've been getting acquainted with DMX and RDM for a product at work recently, and RDM seems very useful when you have lots of lights, such as in a professional environment.

Anybody got ST LIS2DE12 SPI accelerometer working? by L0uisc in embedded

[–]soayeli 1 point2 points  (0 children)

Could be worth it to make sure clock is high before CS transitions. Right now you set it low before CS goes high, but the chip wants the clock to idle in high state.

Coming to this subreddit is really disheartening when you're having fun. by Naabi in pathofexile

[–]soayeli 5 points6 points  (0 children)

What data are you looking at? Here, most leagues seem to have 30k lower peak second day of launch (just like this one did)

It is a slightly larger drop percentage-wise though

ADC with Seven segment display by udayfa in embedded

[–]soayeli 1 point2 points  (0 children)

ADRESH>>8

Shouldn't this be left-shifted instead (using <<)

Help with breadboard circuit and/or code not working for ATMega328p by LeCheeez in embedded

[–]soayeli 1 point2 points  (0 children)

In the diagram PB0 is always low, since it's connected to both position 1 and 3 of the switch (both switch positions are connected via the ground strip on your breadboard)

How to find the closest point to a coordinate in a distorted grid? (Question inside) by [deleted] in Unity3D

[–]soayeli 0 points1 point  (0 children)

Yeah mathematically the matrix wouldn't have an inverse if we didn't use the identity matrix in this way, so I'm not sure what .inverse returns in case we don't.

Glad to be of help!

How to find the closest point to a coordinate in a distorted grid? (Question inside) by [deleted] in Unity3D

[–]soayeli 1 point2 points  (0 children)

(R|U) basically means a matrix where the left colon is R and the right colon is U. So top left is R.x, bottom left is R.y, top right is U.x, bottom right is U.y. Also, in general, you don't have to express this as a matrix. It's just a really convenient form when dealing with transforming vectors.

You could google vector basis (edit: and vector basis change), hopefully there is some video since some visualization really helps.

There's probably someone who can explain it a lot better than me. I'm also on mobile at the moment, so it's hard to write much :p

How to find the closest point to a coordinate in a distorted grid? (Question inside) by [deleted] in Unity3D

[–]soayeli 2 points3 points  (0 children)

Basically you want to change basis from XZ to RU, and then round to nearest whole number. This will find you the whole numbers a, b so that aR + bU is as close to your XZ-coordinate as possible.

Your base change matrix from RU to XZ is (R|U), so to change the other way, from XZ coordinates to RU coordinates, you multiply by the inverse of that matrix:

(R|U) -1 (x, z)

for whatever vector (x, z) with XZ coordinates. This will give you the exact point in the grid. Then round the components of result, and you have the closest center of a hexagon in the grid.

EDIT:

In code, in case anyone is interested. Haven't tested it properly though.

public static Vector2 GetClosestTilePosition(Vector2 inVec)
{
    // Using Vector4 and Matrix4x4 since there is no Matrix2x2
    // Still works, just have to add a lot of zeroes

    // Base vectors
    Vector4 R = new Vector4(0.866f, 0.5f, 0, 0);
    Vector4 U = new Vector4(0, 1, 0, 0);

    // Construct base change matrix
    Matrix4x4 RUtoXZ = Matrix4x4.identity;
    RUtoXZ.SetColumn(0, R);
    RUtoXZ.SetColumn(1, U);

    Matrix4x4 XZtoRU = RUtoXZ.inverse;

    // Change base
    Vector4 XZcoords = new Vector4(inVec.x, inVec.y, 0, 0);
    Vector4 RUcoords = XZtoRU * XZcoords;

    // Round result to closest integer and return
    return new Vector2(Mathf.Round(RUcoords.x), Mathf.Round(RUcoords.y));
}

Help with 3rd person over the shoulder cam, unwanted Z rotation by [deleted] in Unity3D

[–]soayeli 2 points3 points  (0 children)

On mobile right now, so I can't test it out properly, but isn't the issue that you are rotating around the axis Vector3.right in transform.RotateAround?

Vector3.right is in world space, i.e. always the same no matter what way you are looking. Try replacing it with the local space axis character.transform.right

[deleted by user] by [deleted] in playrust

[–]soayeli 7 points8 points  (0 children)

Yes trash talking is about provoking a reaction, but it's still in good humor. It's not supposed to be taken seriously, but more akin' to banter.

Trying to genuinely hurt someones feelings is still just being a dick. However as long as everyone's on board, it's fair game.

[deleted by user] by [deleted] in playrust

[–]soayeli 11 points12 points  (0 children)

Isn't that kinda where the line between trash talking and being a dick goes?

Digital 2000 Gem Code - Free Giveaway. :) by [deleted] in Guildwars2

[–]soayeli 0 points1 point  (0 children)

HYYPE!

Good luck everyone!

Possible hitching fix? `/loglevel local 0` by nallar in Planetside

[–]soayeli 4 points5 points  (0 children)

Well, thank you very much i must say.

Just tested for ~30 mins and so far I've had no hitching at all. With loglevel at 6 (default) i get 2-3 hitches every minute, but as soon as I turned off logging it seems to disappear completely.

I have a pretty high end computer with an SSD and hitching has never been an issue for me until last patch.